[R] Rep mahalanobis distance

Cabannes scabannes at free.fr
Fri Jun 24 16:13:22 CEST 2005


Dear Karen,

> I am trying to calculate Mahalanobis distances for a matrix called 
> "fgmatrix"
>

> Then I get an error message "Covariance matrix is apparently singular"
>
> What does this mean? I can't see anything strange about the covariance 
> matrix, and am not getting anywhere with the help files.
>
As you can read in the help for "mahalanobis distance" :

    Returns the Mahalanobis distance of all rows in 'x' and the vector
    mu='center' with respect to Sigma='cov'. This is (for vector 'x')
    defined as

                D2 = (x - mu)' Sigma^{-1} (x - mu)

that need to invert the cov matrix, so if not invertible...

Sam




More information about the R-help mailing list