[R] wrong plot with fda or lda?

Alejo C.S. alej.c.s at gmail.com
Fri Oct 9 18:25:08 CEST 2009


Hi,
I have a strange behavior of plot function when trying to plot a
discriminant analysis obtained by fda.
I'd attached the data for reproduction. I made the same analysis (linear
discriminant analysis) but using lda and fda (default args, using
"polyreg"). The resulting coefficients and trace proportions for the two
analysis are the same, that's good, but if you plot the two analysis the
graphs are very different. Plotting the results of lda function gives much
more overlapping of points from different groups than using fda.


 If you make:

libray(MASS)
library(mda)

read.table("data", header=T) -> data

data[,1] -> grp
data[,2:24] -> X

#Linear discriminant analysis using fda
fda(grp ~ ., data=X) -> FDA
plot(FDA)

#Linear discriminant analysis using lda
lda(grp ~ ., data=X) -> LDA
plot(LDA, col=palette()[grp])# Very different results

#Same coefficients
coef(FDA)
coef(LDA)

Regards,


More information about the R-help mailing list