Re: [R] Mahalanobis distances

From: Christian Hennig <chrish_at_stats.ucl.ac.uk>
Date: Sat 25 Jun 2005 - 02:02:53 EST

On Fri, 24 Jun 2005, Spencer Graves wrote:

(...)
> The key is computing your own generalized inverse and using that with
> "inverted=TRUE".
(...)

One method to do this is function solvecov in package fpc.

Christian

>
> spencer graves
>
> Karen Kotschy wrote:
> > 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
>
> --
> Spencer Graves, PhD
> Senior Development Engineer
> PDF Solutions, Inc.
> 333 West San Carlos Street Suite 700
> San Jose, CA 95110, USA
>
> spencer.graves@pdf.com
> www.pdf.com <http://www.pdf.com>
> Tel: 408-938-4420
> Fax: 408-280-7915
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 25 02:06:54 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:02 EST