Reputation: 65
I have a set of 3D coordinates and want to identify the test data according to the train data using LDA. However, a large number of my test data are misidentified. Here are the codes that I used. I have 31 landmarks, 128 (from 1 to 128) train samples from 3 different species, and 81 (from 129 to 210) test samples. My group labels are located in the 5th column of "MC_code". For LDA, I used the first 9 principal components. Could anyone help me to have better results?
MC_coord <- read.table(file.choose(), header = F)
MC_code <- read.table(file.choose(), header = T)
MC_ar <- arrayspecs(as.matrix(MC_coord),31,3)
MC_arOK <- estimate.missing(MC_ar,method="Reg")
super_MC <- gpagen(MC_arOK)
PCA_MC <- gm.prcomp(super_MC$coords)
train <- PCA_MC$x[1:128,1:9]
train_code <- MC_code[1:128, 5]
test <- PCA_MC$x [129:210, 1:9]
LDA_MC <- lda(train, train_code)
PA_LDA_MC <- predict (LDA_MC, test)
Upvotes: 0
Views: 25