annotate toolboxes/FullBNT-1.0.7/KPMstats/student_t_prob.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 |
|
rev |
line source |
Daniel@0
|
1 function p = student_t_pdf(X, mu, lambda, alpha)
|
Daniel@0
|
2 % STUDENT_T_PDF Evaluate the multivariate student-t distribution at a point
|
Daniel@0
|
3 % p = student_t_pdf(X, mu, lambda, alpha)
|
Daniel@0
|
4 %
|
Daniel@0
|
5 % Each column of X is evaluated.
|
Daniel@0
|
6 % See Bernardo and Smith p435.
|
Daniel@0
|
7
|
Daniel@0
|
8 k = length(mu);
|
Daniel@0
|
9 assert(size(X,1) == k);
|
Daniel@0
|
10 [k N] = size(X);
|
Daniel@0
|
11 numer = gamma(0.5*(alpha+k));
|
Daniel@0
|
12 denom = gamma(0.5*alpha) * (alpha*pi)^(k/2);
|
Daniel@0
|
13 c = (numer/denom) * det(lambda)^(0.5);
|
Daniel@0
|
14 p = c*(1 + (1/alpha)*(X-mu)'*lambda*(X-mu))^(-(alpha+k)/2); % scalar version
|
Daniel@0
|
15 %m = repmat(mu(:), 1, N);
|
Daniel@0
|
16 %exponent = sum((X-m)'*lambda*(X-m), 2); % column vector
|
Daniel@0
|
17 %p = c*(1 + (1/alpha)*exponent).^(-(alpha+k)/2);
|
Daniel@0
|
18
|
Daniel@0
|
19 keyboard
|