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).
|