[R] conflicting results on NA in a qda predicted object:

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 20 11:29:07 CET 2001


This is a factor.  You have to be careful with NAs in factors (and 1.4.0
is different there as it happens).

Nevertheless, there is no way to reproduce this from what you have given.
Check that the class really is "factor", and then unclass it to see what
the codes actually are.  One or more of them should be NA from what you
have given.


On Thu, 20 Dec 2001, Agustin Lobo wrote:

>
> Dear list,
>
> (I've not upgraded to R1.4 yet)
>
> I have the following $class component in a predict.qda object:
> > unique(mod23S.qda.pred$class)
>  [1] 12 17 8  10 4  9  5  13 14 19 20 15 6  3  7  1  23 11 18 21 16 2  22 NA
> Levels:  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
>
> Nevertheless, when I try to identify the individual(s) with NA, I get:
> > any(is.na(mod23S.qda.pred$class))
> [1] FALSE
>
> and
>
> > mod23S.qda.pred$class[is.na(mod23S.qda.pred$class)]
> factor(0)
> Levels:  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
>
> So, actually, is there a NA value in mod23S.qda.pred$class or not?
>
> (screening by eye it`s impossible:
> length(mod23S.qda.pred$class) is 26375 )
>
> Agus
>
> Dr. Agustin Lobo
> Instituto de Ciencias de la Tierra (CSIC)
> Lluis Sole Sabaris s/n
> 08028 Barcelona SPAIN
> tel 34 93409 5410
> fax 34 93411 0012
> alobo at ija.csic.es
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
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