annotate toolboxes/FullBNT-1.0.7/KPMstats/student_t_logprob.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function L = log_student_pdf(X, mu, lambda, alpha)
wolffd@0 2 % LOG_STUDENT_PDF Evaluate the log of the multivariate student-t distribution at a point
wolffd@0 3 % L = log_student_pdf(X, mu, lambda, alpha)
wolffd@0 4 %
wolffd@0 5 % Each column of X is evaluated.
wolffd@0 6 % See Bernardo and Smith p435.
wolffd@0 7
wolffd@0 8 k = length(mu);
wolffd@0 9 assert(size(X,1) == k);
wolffd@0 10 [k N] = size(X);
wolffd@0 11 logc = gammaln(0.5*(alpha+k)) - gammaln(0.5*alpha) - (k/2)*log(alpha*pi) + 0.5*log(det(lambda));
wolffd@0 12 middle = (1 + (1/alpha)*(X-mu)'*lambda*(X-mu)); % scalar version
wolffd@0 13 L = logc - ((alpha+k)/2)*log(middle);