[R] mahalanobis

From: <gatemaze_at_gmail.com>
Date: Thu, 31 May 2007 17:32:20 +0100

Hi, I am not sure I am using correctly the mahalanobis distnace method... Suppose I have a response variable Y and predictor variables X1 and X2

all <- cbind(Y, X1, X2)
mahalanobis(all, colMeans(all), cov(all));

However, my results from this are different from the ones I am getting using another statistical software.

I was reading that the comparison is with the means of the predictor variables which led me to think that the above should be transformed into:

predictors <- cbind(X1, X2)
mahalanobis(all, colMeans(predictors), cov(all))

But still the results are different....

Am I doing something wrong or have I misunderstood something in the use of the function mahalanobis? Thanks.


R-help_at_stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 31 May 2007 - 16:39:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 02 Jun 2007 - 19:31:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.