Greetings, I am puzzled about why the _classical_ Mahalanobis distances that I get using the {stats} mahalanobis() function do not match the distances I get from the {robustbase} covMcd() function. Here is an example:
x <- matrix(rnorm(10*3), ncol = 3) #here is the {stats} result: Sx <- cov(x) D2 <- mahalanobis(x, colMeans(x), Sx) D2 [1] 1.5135795 1.3761046 1.0367444 1.8111585 4.3038621 5.3195918 3.2798665 5.7559301 [9] 2.2172150 0.3859475 #here is the {robustbase} result Library(robustbase) D2rb<- covMcd(x) D2rb$raw.mah [1] 0.7737193 1.1177445 0.7290794 0.6275703 3.5517622 6.0334350 1.0582663 5.7169250 [9] 0.9420184 0.4210470 According to the help file for covMcd{robustbase} raw.mah mahalanobis distances of the observations based on the raw estimate of the location and scatter. So I think the second set of numbers should match the first. But they do not. What am I missing here? Thanks, Fraser ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.