[R] Discriminant function analysis

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Feb 7 17:34:03 CET 2008


On Thu, 2008-02-07 at 11:16 -0400, tyler wrote:
> On Thu, Feb 07, 2008 at 02:36:58PM +0000, Gavin Simpson wrote:
> > 
> > But I'm not sure this matters much. If you use the formula interface to
> > lda(), factors get expanded to the dummy variables Tyler is talking
> > about. But of course, a factor with two levels 0/1 doesn't need much
> > manipulation as you only need a single dummy variable to represent its
> > two states:
> > 
> 
> Thanks, Gavin!
> 
> R's formula interface if very powerful, and I'm just starting to
> understand how to take full advantage of it.
> 
> > You might want to standardise your exp variables to zero mean and unit
> > variance prior to doing the lda so that all variables carry the same
> > weight, if you have mixtures of numeric (continuous) variables and
> > binary ones.
> 
> This is the part I was unsure of. If you have a categorical
> explanatory variable with five levels, you can turn it into four dummy
> variables, which you then standardize. Does the original variable end
> up getting four times the weight of a single numerical variable?

I have no idea Tyler. I would take great heed in the warning about using
only continuous variables in lda() - the author(s) of that function
certainly know what they are talking about! One is probably violating
some of the underlying assumptions of the method using
binary/categorical data.

There are better classification tools available than LDA for mixed data
like this, such as a classification tree, which is easy to interpret
(always good for ecologists ;-) or some of the bagging, boosting or
random forest algorithms also spring to mind. There has been quite a lot
on these techniques in the ecological literature in the past 3-4 years.

HTH

G

> 
> Cheers,
> 
> Tyler
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list