diff toolboxes/FullBNT-1.0.7/KPMstats/student_t_logprob.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/FullBNT-1.0.7/KPMstats/student_t_logprob.m	Fri Aug 19 13:07:06 2016 +0200
@@ -0,0 +1,13 @@
+function L = log_student_pdf(X, mu, lambda, alpha)
+% LOG_STUDENT_PDF Evaluate the log of the multivariate student-t distribution at a point
+% L = log_student_pdf(X, mu, lambda, alpha)
+%
+% Each column of X is evaluated.
+% See Bernardo and Smith p435.
+
+k = length(mu);
+assert(size(X,1) == k);
+[k N] = size(X);
+logc = gammaln(0.5*(alpha+k)) - gammaln(0.5*alpha) - (k/2)*log(alpha*pi) + 0.5*log(det(lambda));
+middle = (1 + (1/alpha)*(X-mu)'*lambda*(X-mu)); % scalar version
+L = logc - ((alpha+k)/2)*log(middle);