[R] lda from MASS function

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Jul 3 21:04:28 CEST 2002


On Wed, 3 Jul 2002, Rishabh Gupta wrote:

> Hi all,
>     I am using the lda function from the MASS library to measure the discriminance of different variables with respect to different
> grouping variables by using
>
>     lda( RESULTVARS[, 1:750] , GROUPVAR , tol=0 )    where RESULTVARS contains some 750 different variables.
>
> Occasionally there is a variable within RESULTVARS that has the same values for all values of GROUPVAR, ie no variance so I get the
> error:
>
> Error in svd(X, nu = 0) : NA/NaN/Inf in foreign function call (arg 1)
>
> As I understand it, this is due to the a division of zero in one svd function that is used by lda. The nature of my results are such
> that every now and than I will get a case where all the values for a RESULTVARS variable are constant. Is there a way of getting
> past this problem. For example, by using the tol=0 parameter I can avoid problems when the variables are the same within a
> particular group. As far as I am concerned, cases where the variables are constant across all groups is saying that that variable
> has zero discriminance.

You are wrong: that is what the tol argument is for.
You need to delete the constant variables, which contradict the lda model.

Do you really believe is multivariate normality for 750 dimensions?
I wouldn't!

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list