, you know the identity of each individual (unlike cluster analysis) and you want to know how the
explanatory variables contribute to the correct classification of individuals. The method works by uncovering
relationships among the groups’ covariance matrices to discriminate between groups. With k groups you
will need k – 1 discriminators. The functions you will need for discriminant analysis are available in the
explanatory variables contribute to the correct classification of individuals. The method works by uncovering
relationships among the groups’ covariance matrices to discriminate between groups. With k groups you
will need k – 1 discriminators. The functions you will need for discriminant analysis are available in the
MASS library.
library(MASS)
model <- lda(Taxon~.,taxa)
plot(model,col=rep(1:4,each=30))
predict(model)
train <- sort(sample(1:120,60))
table(Taxon[train])
model2 <- lda(Taxon~.,taxa,subset=train)
predict(model2)
unused <- taxa[-train,]
predict(model,unused)
table(unused$Taxon)