[R] Error with function lda in package MASS (dimnames not equal?)
Joshua Gilbert
joshuacgilbert at gmail.com
Sat Jun 11 20:19:37 CEST 2005
This is true, they are equal. I hadn't noticed that. Thank you.
Now, if lda fails on this given input (equal means), shouldn't we
catch it and give a slightly better error message? I've spent a good
while going through the debugging process with lda.default. From that
perspective it appears that there is a simple change to remove the
problem. I am not saying that it is correct in any shape or form, but
there is a point where a single transpose would silence the error.
So, from a usability standpoint, could we add a check for equal means
between classes and throw an error for that specific condition? Yes,
the user should not do that. But users may become more interested in
making the code run than checking on whether it's doing anything sane.
If this isn't the place to do so, tell me. But, I'd like to petition
to alter the code of lda.default.
On 6/10/05, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> lda.default <- MASS:::lda.default and proceed.
>
> Look at the group means of your data: they are identical to machine
> accuracy.
>
> The question has to be `why are you trying to use lda to separate
> two groups with identical means'? Lda is not protected against that
> and it is rather unlikely unless you failed to inspect your data in any
> way.
>
> On Fri, 10 Jun 2005, Joshua Gilbert wrote:
>
> > This question appears to have been asked previously, but not answered.
> > the last response I can find to this previous thread is here:
> > http://tolstoy.newcastle.edu.au/R/help/04/07/0126.html. The asnwer was
> > to provide debugging info, not an answer.
> >
> > So the problem is that I'm trying to use lda on my dataset. You can
> > download my data here:
> > http://northstar-www.dartmouth.edu/~jgilbert/nolda, I used R's save
> > function to save objects data and classes (yes, I realize that I name
> > stomped the data function in package utils). To replicate my results,
> > simply enter the following:
> >> library(MASS)
> >> load('nolda')
> >> lda(data,classes)
> > Error in lda.default(x, grouping, ...) : length of 'dimnames' [2] not
> > equal to array extent
> >
> > Now, I don't know what that means.
> >> dimnames(data)
> > NULL
> >> dimnames(classes)
> > NULL
> >
> > As for debugging, I don't know how. I cannot debug lda.default as I
> > get the following:
> >> debug(lda.default)
> > Error: Object "lda.default" not found
> >
> > I think that that's pretty much it. Can anyone help me?
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
>
> --
> 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 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
More information about the R-help
mailing list