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