


Evaluates the density of a multivariate student, with expectation Mean,
variance Sigma_upper_chol'*Sigma_upper_chol and degrees of freedom df, 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").
df [integer] degrees of freedom.
OUTPUTS
density [double] density.
SPECIAL REQUIREMENTS

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