about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/conf2mahal.m
diff options
context:
space:
mode:
authorziejd22017-09-28 15:04:40 -0500
committerziejd22017-09-28 15:04:40 -0500
commit8070dc963753142bb86c4ed698d91fd623ed28e7 (patch)
treed0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/KPMtools/conf2mahal.m
parent7cc31810d53176e805532b2789955f4eedbce6bb (diff)
downloadBNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning.

I am calling this BNW_1.02. It can be accessed at:
compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/KPMtools/conf2mahal.m')
-rw-r--r--sourcecodes/bnt-master/KPMtools/conf2mahal.m62
1 files changed, 62 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/KPMtools/conf2mahal.m b/sourcecodes/bnt-master/KPMtools/conf2mahal.m
new file mode 100644
index 00000000..8e96dd18
--- /dev/null
+++ b/sourcecodes/bnt-master/KPMtools/conf2mahal.m
@@ -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