[R] LDA in R: how to extract full equation, especially constant term
Frank Gibbons
fgibbons at hms.harvard.edu
Fri Aug 22 00:35:15 CEST 2003
Hi,
Having dipped my toe into R a few times over the last year or two, in the
last few weeks I've been using it more and more; I'm now a thorough
convert. I've just joined the list, because although it's great, I do have
this problem...
I'm using linear discriminant analysis for binary classification, and am
happy with the classification performance using predict(). What I'd like to
do now is extract the equation for this classifier, for use elsewhere (in
Perl/Python code).
I know that I can get the means and scaling factors from the predict()
object, but I'm having trouble computing the constant term. From reading
Venables & Ripley and Hastie/Tibshirani/Friedman, I know the priors play
a role in adjusting the "cut-point" from zero (for equally sized classes),
based on the relative sizes of the two classes. But when I try to do the
computation, I don't get a value that agrees with that returned by predict().
I've seen a post about this problem in the past, but it was never really
answered by anyone who was familiar with R/S-PLUS. Can anyone help me with
this? I guess I'm really wondering how R is computing the constant term in
its discriminant function.
Thanks,
-Frank Gibbons
PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555 Fax:
617-432-3557 http://llama.med.harvard.edu/~fgibbons
More information about the R-help
mailing list