s-news
[Top] [All Lists]

Re: mahalanobis distance

To: Antoine van Kampen <a.h.vankampen@amc.uva.nl>
Subject: Re: mahalanobis distance
From: kpadayachee@mmm.com
Date: Mon, 20 Nov 2000 14:17:24 -0500
Cc: s-news@wubios.wustl.edu

When I plot the mahalanobis distance with plot.mcd(cov.mcd(x)) the resulting

distances are a factor 10 smaller compared to doing:

c<-cov.mcd(x)

d<-mahalanobis(x,c$center,c$cov)

How should I interpret this?

The plot.mcd routine in S+ contains this piece of code to calculate MD ( =
"Mahalanobis Distance" )
     X <- mcd.obj$X
     center <- mcd.obj$center
     cov <- mcd.obj$cov
     n <- nrow(as.matrix(X))
     MD <- sqrt(mahalanobis(X, apply(X, 2, mean), n/(
          n - 1) * cov.wt(X)$cov))
     RD <- sqrt(mahalanobis(X, center, cov))

X   is the original data set  and cov.wt(X)$cov  is the estimated covariance
matrix  NOT the robust cov. matrix  (a la Rouseeuw
et. al.).

In fact     RD^2 = d   ( = mahalanobis(x,c$center,c$cov).




<Prev in Thread] Current Thread [Next in Thread>