Mercurial > hg > camir-aes2014
diff toolboxes/FullBNT-1.0.7/KPMtools/conf2mahal.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/FullBNT-1.0.7/KPMtools/conf2mahal.m Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,62 @@ +% CONF2MAHAL - Translates a confidence interval to a Mahalanobis +% distance. Consider a multivariate Gaussian +% distribution of the form +% +% p(x) = 1/sqrt((2 * pi)^d * det(C)) * exp((-1/2) * MD(x, m, inv(C))) +% +% where MD(x, m, P) is the Mahalanobis distance from x +% to m under P: +% +% MD(x, m, P) = (x - m) * P * (x - m)' +% +% A particular Mahalanobis distance k identifies an +% ellipsoid centered at the mean of the distribution. +% The confidence interval associated with this ellipsoid +% is the probability mass enclosed by it. Similarly, +% a particular confidence interval uniquely determines +% an ellipsoid with a fixed Mahalanobis distance. +% +% If X is an d dimensional Gaussian-distributed vector, +% then the Mahalanobis distance of X is distributed +% according to the Chi-squared distribution with d +% degrees of freedom. Thus, the Mahalanobis distance is +% determined by evaluating the inverse cumulative +% distribution function of the chi squared distribution +% up to the confidence value. +% +% Usage: +% +% m = conf2mahal(c, d); +% +% Inputs: +% +% c - the confidence interval +% d - the number of dimensions of the Gaussian distribution +% +% Outputs: +% +% m - the Mahalanobis radius of the ellipsoid enclosing the +% fraction c of the distribution's probability mass +% +% See also: MAHAL2CONF + +% Copyright (C) 2002 Mark A. Paskin +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +% USA. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function m = conf2mahal(c, d) + +m = chi2inv(c, d); \ No newline at end of file