[R] Mahalanobis distances

Karen Kotschy karen at biology.biol.wits.ac.za
Fri Jun 24 16:22:13 CEST 2005


Dear R community

Have just recently got back into R after a long break and have been amazed at 
how much it has grown, and how active the list is! Thank you so much to all 
those who contribute to this amazing project.

My question:
I am trying to calculate Mahalanobis distances for a matrix called "fgmatrix"

>dim(fgmatrix)
[1] 76 15

>fg.cov <- cov.wt(fgmatrix)
>mahalanobis(fgmatrix, center = fg.cov$center, cov = fg.cov$cov)

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.

>dim(fg.cov$cov)
[1] 15 15
>length(fg.cov$center)
[1] 15


Thanks
-- 
Karen Kotschy
Centre for Water in the Environment
University of the Witwatersrand
Johannesburg
South Africa

P/Bag X3, Wits, 2050
Tel: +2711 717-6425




More information about the R-help mailing list