Skip to content

qda(MASS) function error

2 messages · Mauro Rossi, Uwe Ligges

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

Thank in advance,
Mauro Rossi
#
Mauro Rossi wrote:
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