Thread Subject: Mahalanobis distance between 2 distributions

Subject: Mahalanobis distance between 2 distributions

From: kais

Date: 12 Mar, 2010 04:38:02

Message: 1 of 2

How can I calculate the Mahalanobis distance between 2 distributions given in matrices X & Y. The mahal.m command gives the distance for each observation (line of X) to the distribution Y and this is not what I want. I want to get the distance between the 2 distributions rather - any already implemented command or option in mahal.m that I overlooked ?

Subject: Mahalanobis distance between 2 distributions

From: Tom Lane

Date: 12 Mar, 2010 20:43:49

Message: 2 of 2

> How can I calculate the Mahalanobis distance between 2 distributions given
> in matrices X & Y. The mahal.m command gives the distance for each
> observation (line of X) to the distribution Y and this is not what I want.
> I want to get the distance between the 2 distributions rather - any
> already implemented command or option in mahal.m that I overlooked ?

Do you intend for this to be based on the pooled covariance matrix based on
both matrices? You could use the manova1 function. Its purpose is to test
for a difference between two samples, but one of its outputs is a matrix of
Mahalanabos distances between pairs of means.

>> x = randn(10,2);
>> y = bsxfun(@plus, 1:2, randn(10,2));
>> [d,p,s] = manova1([x;y], (1:20<11));
>> s.gmdist
ans =
         0 0.4968
    0.4968 0

-- Tom

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com