Hi Alejo,
According to my knowledge the two plots are different because in the
first one a point belongs to a group depending on its group in the data
whereas in the second plot a point belongs to the group predicted by the
linear discriminant analysis.
I hope somebody will correct me if I am wrong.
Alain
Alejo C.S. wrote:
Hi Alain, this is the code:
library(MASS)
library(mda)
#data attached, first column "G3" group membership
X <- read.table("data", header=T)
lda_analysis <- lda(formula(X), data=X)
plot(lda_analysis, col=palette()[X$G3])
#the above plot is completely different to:
plot(predict(lda_analysis)$x, type="n")
text(predict(lda_analysis)$x, labels=predict(lda_analysis)$class,
col=palette()[predict(lda_analysis)$class])
The above code only reproduce the first plot using predict to obtain
coordinates and classes for the first tow discriminant axis.
Thanks ,
Alejo
--
Alain Guillet
Statistician and Computer Scientist
SMCS - Institut de statistique - Université catholique de Louvain
Bureau c.316
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium
tel: +32 10 47 30 50
______________________________________________
R-help@r-project.org 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.