wolffd@0
|
1 % MAHAL2CONF - Translates a Mahalanobis distance into a confidence
|
wolffd@0
|
2 % interval. Consider a multivariate Gaussian
|
wolffd@0
|
3 % distribution of the form
|
wolffd@0
|
4 %
|
wolffd@0
|
5 % p(x) = 1/sqrt((2 * pi)^d * det(C)) * exp((-1/2) * MD(x, m, inv(C)))
|
wolffd@0
|
6 %
|
wolffd@0
|
7 % where MD(x, m, P) is the Mahalanobis distance from x
|
wolffd@0
|
8 % to m under P:
|
wolffd@0
|
9 %
|
wolffd@0
|
10 % MD(x, m, P) = (x - m) * P * (x - m)'
|
wolffd@0
|
11 %
|
wolffd@0
|
12 % A particular Mahalanobis distance k identifies an
|
wolffd@0
|
13 % ellipsoid centered at the mean of the distribution.
|
wolffd@0
|
14 % The confidence interval associated with this ellipsoid
|
wolffd@0
|
15 % is the probability mass enclosed by it.
|
wolffd@0
|
16 %
|
wolffd@0
|
17 % If X is an d dimensional Gaussian-distributed vector,
|
wolffd@0
|
18 % then the Mahalanobis distance of X is distributed
|
wolffd@0
|
19 % according to the Chi-squared distribution with d
|
wolffd@0
|
20 % degrees of freedom. Thus, the confidence interval is
|
wolffd@0
|
21 % determined by integrating the chi squared distribution
|
wolffd@0
|
22 % up to the Mahalanobis distance of the measurement.
|
wolffd@0
|
23 %
|
wolffd@0
|
24 % Usage:
|
wolffd@0
|
25 %
|
wolffd@0
|
26 % c = mahal2conf(m, d);
|
wolffd@0
|
27 %
|
wolffd@0
|
28 % Inputs:
|
wolffd@0
|
29 %
|
wolffd@0
|
30 % m - the Mahalanobis radius of the ellipsoid
|
wolffd@0
|
31 % d - the number of dimensions of the Gaussian distribution
|
wolffd@0
|
32 %
|
wolffd@0
|
33 % Outputs:
|
wolffd@0
|
34 %
|
wolffd@0
|
35 % c - the confidence interval, i.e., the fraction of
|
wolffd@0
|
36 % probability mass enclosed by the ellipsoid with the
|
wolffd@0
|
37 % supplied Mahalanobis distance
|
wolffd@0
|
38 %
|
wolffd@0
|
39 % See also: CONF2MAHAL
|
wolffd@0
|
40
|
wolffd@0
|
41 % Copyright (C) 2002 Mark A. Paskin
|
wolffd@0
|
42 %
|
wolffd@0
|
43 % This program is free software; you can redistribute it and/or modify
|
wolffd@0
|
44 % it under the terms of the GNU General Public License as published by
|
wolffd@0
|
45 % the Free Software Foundation; either version 2 of the License, or
|
wolffd@0
|
46 % (at your option) any later version.
|
wolffd@0
|
47 %
|
wolffd@0
|
48 % This program is distributed in the hope that it will be useful, but
|
wolffd@0
|
49 % WITHOUT ANY WARRANTY; without even the implied warranty of
|
wolffd@0
|
50 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
wolffd@0
|
51 % General Public License for more details.
|
wolffd@0
|
52 %
|
wolffd@0
|
53 % You should have received a copy of the GNU General Public License
|
wolffd@0
|
54 % along with this program; if not, write to the Free Software
|
wolffd@0
|
55 % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
wolffd@0
|
56 % USA.
|
wolffd@0
|
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
58 function c = mahal2conf(m, d)
|
wolffd@0
|
59
|
wolffd@0
|
60 c = chi2cdf(m, d); |