0

I've read the paper of Gardner and Le Roux about Extensions of Biplot Methodology to Discriminant Analysis. I wanted to ask if someone got any practical experience with that method. I've got a FDA model for a data set from kaggle Human Resources Analytics, available here data set. I used the code

modFDA = train(left~. , data = train, method = 'fda', 
            tuneGrid = data.frame(degree = 1:10, nprune = 1:10),
            trControl = trainControl(method = 'cv', number = 10, repeats = 5))

to fit the model. The training sample was chosen using

smp.size = floor(0.7*nrow(data))
set.seed(123)
train.ind = sample(seq_len(nrow(data)), size = smp.size)
train = data[train.ind,]
test = data[-train.ind,]

When I try using the biplot function I get an error for missing y values. I know there's a ggbiplot function but it only seems to work for LDA, since it requires linear discriminants for plotting. And I can't find those more precisely discriminant values in my model output. I seem to be missing something but I can't figure out what it is..

some more of my code

biplot(modFDA$finalModel)

returns missing y values.

Also tried to scale the data set

train_z = lapply(train, function(x) if (is.numeric(x)) scale(x) else x)
FDAfit = fda(left~., data = train_z)
df = fortify(FDAfit, train_z)

tried to fit an ggplot using an example on the iris data but using LDA, but don't know what to use for aes. also there seems to be no function named geom_axis

g <- ggplot(df, aes(x = (LD1)?, y = (LD2)?)) +
  geom_point(aes(color = left)) + 
  stat_ellipse(aes(group = left, color = left)) +
  geom_axis(data = attr(df, "basis"), aes(label = abbreviate(.name))) + 
  coord_equal()  
Marco Sandri
  • 23,289
  • 7
  • 54
  • 58
sha
  • 1
  • 1
  • It would be helpful if you provided the name of the R package that allows users to download the `train` data and call the function. – jkt Aug 01 '17 at 13:51
  • I've downloaded it from kaggle and then just used `read.csv` but I've made it available here: [data] (https://ufile.io/bsu80). for the biplot I simply used `biplot(modFDA$finalModel)` – sha Aug 01 '17 at 14:01

0 Answers0