annotate toolboxes/FullBNT-1.0.7/KPMstats/student_t_prob.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 p = student_t_pdf(X, mu, lambda, alpha)
wolffd@0 2 % STUDENT_T_PDF Evaluate the multivariate student-t distribution at a point
wolffd@0 3 % p = student_t_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 numer = gamma(0.5*(alpha+k));
wolffd@0 12 denom = gamma(0.5*alpha) * (alpha*pi)^(k/2);
wolffd@0 13 c = (numer/denom) * det(lambda)^(0.5);
wolffd@0 14 p = c*(1 + (1/alpha)*(X-mu)'*lambda*(X-mu))^(-(alpha+k)/2); % scalar version
wolffd@0 15 %m = repmat(mu(:), 1, N);
wolffd@0 16 %exponent = sum((X-m)'*lambda*(X-m), 2); % column vector
wolffd@0 17 %p = c*(1 + (1/alpha)*exponent).^(-(alpha+k)/2);
wolffd@0 18
wolffd@0 19 keyboard