Re: [R] linear discriminant analysis in MASS

From: Prof Brian Ripley <>
Date: Tue 21 Feb 2006 - 19:01:15 EST

On Mon, 20 Feb 2006, Alain Paquette wrote:

> Hello R people
> I now know how to run my discriminant analysis with the lda function in
> lda.alain=lda(Groupes ~ Ht.D0 + Lc.Dc + Ram + IDF, gr, CV = FALSE)
> and it works fine.

CV=FALSE is the default and so not needed.

> But I am missing a test and cannot find any help on how to get it, if it
> exist.
> The "S" equivalent:

There is no such function in S, and I rather object as the S equivalent is lda() (and as the author of both I should know). Credit where credit is due: discrim() is an S-PLUS function, indebted to lda().

> discrim(structure(.Data = Groupes ~ Ht.D0 + Lc.Dc + Ram + IDF, class =
> "formula"), data = gr, family = Canonical(cov.structure =
> "homoscedastic"), na.action = na.omit, prior = "proportional")
> outputs a nice matrix of Mahalanobis distances between groups and even
> tests (Hotelling's T Squared) for significant distances.

Well, it seems not to. That is part of the output of the summary() method, which itself calls the multicomp() method.

> Why don't I just take the "S" output you say? Because like you, I'd
> rather put in my paper that I did it using R of course!

No `of course' applies. If you learnt of this output from S-PLUS, I urge you to credit it honestly and accurately. (If you refer to lda, you should credit that, not just R.)

> Does anyone know of a way to get this test out of lda? Or of another R
> package that does it?

Mahalanobis distance between groups is easy, as this is just Euclidean distance between group centres in the scaled space. The test statistics can be produced, but

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Tue Feb 21 19:05:08 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:38 EST