[R] qda(MASS) function error
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Jul 26 09:15:21 CEST 2007
Mauro Rossi wrote:
> Dear R user,
> I'm using qda (quadratic discriminant analysis) function (package MASS)
> to classify 58 explanatory variables (numeric type with different
> ranges) using a grouping variable (factor 2 levels "0" "1"). I'm using
> the qda method for class 'data.frame' (in this way I don't need to
> specify a formula).
> Using the function:
> result.qda<-qda(explanatory.variables, grouping.variable, method="moment")
> I obtain the following error message:
> "Error in qda.default(x, grouping, ...) : rank deficiency in group 0"
> I run the script excluding some variables and I've individuated 2
> explanatory variables that give problems, but I don't understand why
> they give them. The two excluded variables are numeric with two possible
> values: 0 and 1, but in the rest of group of variables, some similar
> variables are considered.
>
> I don't have this problem using lda function for linear discriminant
> analysis.
>
> What does this error message mean?
> What types of variables does qda function consider?
Well, qda assumes real values (and not factors) in the explanatory
variables. If you think it makes sense to ignore this assumption (and I
doubt it makes sense), then the error message tells you there is a rank
deficiency, i.e. some variables might be collinear.
Hence at least one of the covariance matrices cannot be inverted.
Uwe Ligges
> Thank in advance,
> Mauro Rossi
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list