[R] computationally singular

From: Weiwei Shi <helprhelp_at_gmail.com>
Date: Tue 09 Aug 2005 - 02:53:19 EST

I have a dataset which has around 138 variables and 30,000 cases. I am trying to calculate a mahalanobis distance matrix for them and my procedure is like this:

Suppose my data is stored in mymatrix
> S<-cov(mymatrix) # this is fine
> D<-sapply(1:nrow(mymatrix), function(i) mahalanobis(mymatrix, mymatrix[i,], S))
Error in solve.default(cov, ...) : system is computationally singular: reciprocal condition number = 1.09501e-25

I understand the error message but I don't know how to trace down which variables caused this so that I can "sacrifice" them if there are not a lot. Again, not sure if it is due to some variables and not sure if dropping variables is a good idea either.

Thanks for help,


Weiwei Shi, Ph.D

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Aug 09 03:02:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:45 EST