Home > matlab > distributions > multivariate_normal_pdf.m

multivariate_normal_pdf

PURPOSE ^

Evaluates the density of a multivariate gaussian, with expectation Mean

SYNOPSIS ^

function density = multivariate_normal_pdf(X,Mean,Sigma_upper_chol,n);

DESCRIPTION ^

 Evaluates the density of a multivariate gaussian, with expectation Mean
 and variance Sigma_upper_chol'*Sigma_upper_chol, at X.
 

 INPUTS 

    X                  [double]    1*n vector        
    Mean               [double]    1*n vector, expectation of the multivariate random variable.
    Sigma_upper_chol   [double]    n*n matrix, upper triangular Cholesky decomposition of Sigma (the covariance matrix).
    n                  [integer]   dimension.
    
 OUTPUTS 
    density            [double]    density 
        
 SPECIAL REQUIREMENTS

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function density = multivariate_normal_pdf(X,Mean,Sigma_upper_chol,n);
0002 % Evaluates the density of a multivariate gaussian, with expectation Mean
0003 % and variance Sigma_upper_chol'*Sigma_upper_chol, at X.
0004 %
0005 %
0006 % INPUTS
0007 %
0008 %    X                  [double]    1*n vector
0009 %    Mean               [double]    1*n vector, expectation of the multivariate random variable.
0010 %    Sigma_upper_chol   [double]    n*n matrix, upper triangular Cholesky decomposition of Sigma (the covariance matrix).
0011 %    n                  [integer]   dimension.
0012 %
0013 % OUTPUTS
0014 %    density            [double]    density
0015 %
0016 % SPECIAL REQUIREMENTS
0017 
0018 % Copyright (C) 2003-2009 Dynare Team
0019 %
0020 % This file is part of Dynare.
0021 %
0022 % Dynare is free software: you can redistribute it and/or modify
0023 % it under the terms of the GNU General Public License as published by
0024 % the Free Software Foundation, either version 3 of the License, or
0025 % (at your option) any later version.
0026 %
0027 % Dynare is distributed in the hope that it will be useful,
0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0030 % GNU General Public License for more details.
0031 %
0032 % You should have received a copy of the GNU General Public License
0033 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0034 density = (2*pi)^(-.5*n) * ... 
0035           prod(diag(Sigma_upper_chol))^(-1) * ...
0036           exp(-.5*(X-Mean)*(Sigma_upper_chol\(transpose(Sigma_upper_chol)\transpose(X-Mean))));

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005