I'm confused on how is the right way to plot a discriminant analysis made by
lda function (MASS package).
(I had attached my data fro reproduction). When I plot a lda object :
X <- read.table("data", header=T)
lda_analysis <- lda(formula(X), data=X)
plot(lda_analysis)
#the above plot is completely different to:
plot(predict(lda_analysis)$x, col=palette()[predict(lda_analysis)$class])
that should be the same graph than the first?
In the second case, I use predict function to obtain the LD1 and LD2
coordinates of lda_analysis (predict(lda_analysis)$x) and it's respective
class (predict(lda_analysis)$class), but it seems that the classes are
different:
table(X$G3, predict(lda_analysis)$class)
B G M
B 29 0 3
G 0 26 2
M 4 0 46
any clues?
Regards,
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.