[R] discriminant function analysis in R

Graham Jones maillists at visiv.co.uk
Wed Mar 30 15:59:12 CEST 2005


In message <200503301005.j2UA3CBr019053 at hypatia.math.ethz.ch>, r-help-
request at stat.math.ethz.ch writes
>Dear R Users,
>
>I'm very very interested in learning how to use R to carry out a 
>classification of data using discriminant function analysis.  I've 
>found the MASS package and the lda function, but the examples in the 
>help system are a bit over my head.  I'm not exactly sure how to 
>interpret the output, for example, of if the inputs I've chosen are 
>best suited to my needs.
[...]

I would recommend writing your own simple version of lda in R. For
example, stick to two class problems, and don't worry too much about
efficiency or dealing with bad input. Then think about how you might
make your routines of more general use (but don't bother to implement
this). This is a good way of learning R, and having got this far on your
own, you will find the documentation and examples for lda make sense.
Well, it worked for me.

Here's some useful functions:
?"%*%"
?t
?determinant
?solve
?mean
?cov
?cat
?scan

-- 
Graham Jones, author of SharpEye Music Reader
http://www.visiv.co.uk
21e Balnakeil, Durness, Lairg, Sutherland, IV27 4PT, Scotland, UK




More information about the R-help mailing list