# [R] system is computationally singular: reciprocal condition number

langvince langv at purdue.edu
Fri Oct 26 01:14:26 CEST 2012

```Hi folks,

I know, this is a fairly common question and I am really disappointed that I
could not find a solution.
I am trying to calculate Mahanalobis distances in a data frame, where I have
several hundreds groups and several hundreds of variables.

Whatever I do, however I subset it I get the "system is computationally
singular: reciprocal condition number" error.
I know what it means and I know what should be the problem, but there is no
way this is a singular matrix.

I have uploaded the input file to my ftp:
It is a tab delimited txt file with no headers.

I tried the StatMatch Mahanalobis function and also this function:

mahal_dist <-function (data, nclass, nvariable) {
dist <- matrix(0, nclass, nclass)
n=0
w <- cov(data)
print(w)
for(i in 1:nclass)  {

for(c in 1:nclass){
diffl <- vector(length = nvariable)
for(l in 1:nvariable){
diffl[l]=abs(data[i,l]-data[c,l])

}
###  matrixes
print(diffl)
dist[i,c]= (t(diffl))%*%(solve(w))%*%(diffl)
}

n=n+1
print(n)
}
return(dist)
sqrt_dist <- sqrt(dist)
print(sqrt_dist)  }

I have a deadline for this project (not a homework:)), and I could always
use this codes, so I thought I will be able to quit the calculations short,
but now I am just lost.

I would really appreciate any help.

Thanks for any help

--
View this message in context: http://r.789695.n4.nabble.com/system-is-computationally-singular-reciprocal-condition-number-tp4647472.html
Sent from the R help mailing list archive at Nabble.com.

```