[R] LDA

About this list Date view Thread view Subject view Author view Attachment view

From: array chip (arrayprofile@yahoo.com)
Date: Wed 02 Apr 2003 - 08:14:47 EST


Message-id: <20030401221447.53241.qmail@web41207.mail.yahoo.com>


I used the "lda" function in the MASS library of S-Plus (R) to do a linear discriminant analysis, and got the linear coefficients, say b1 and b2 for the 2 predictors x1 and x2. I have trouble to calculate the discrimiant scores for each observation, I used 3 ways to try to repeat the scores returned by the "predict" function in S-Plus:

1. b1*x1+b2*x2
2. b1*(x1-mean of x1)+b2*(x2-mean of x2)
3. b1* standardized x1+b2*standardized x2 (standardize: mean 0 & variance 1)

none of the above procedures can repeat the scores returned by the "predict" function. However, method 2 & 3 can predict the classes correctly if using 0 as cutoff, juts like using the "predict function".

What should be the correct formula to compute the scores for each observation?

BTW, how to retrieve the linear coefficients from an lda object? I can't retrieve it by using @coef, @coefficients, etc.

Thank you

---------------------------------

        [[alternate HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:35 EST