Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

multivariate student t distribution pdf in matlab?

412 views
Skip to first unread message

per

unread,
Feb 24, 2009, 9:38:43 AM2/24/09
to
hi all,

i am trying to evaluate the pdf for various points that are
distributed according to a multivariate Student t distribution. all
the stat texts tell me that the multivariate t distribution pdf takes
three parameters: a mean mu and a correlation matrix C, and a degrees-
of-freedom parameter (and the point to evaluate the pdf on obviously.)

the 'mvtpdf' function in matlab takes only two arguments: a degrees-of-
freedom parameter and a correlation matrix C. what happened to the mu
(mean) parameter? is there a way to evaluate this pdf in matlab
according to the parametrization i have above?

thank you.

Peter Perkins

unread,
Feb 24, 2009, 10:56:54 AM2/24/09
to
per wrote:

Strictly speaking, the multivariate t has two parameters, but it's often the case that people add scale and location to that, and a simple transformation does the trick. It's easy to compute the PDF for such a thing by unscaling and unshifting your data, then using MVTPDF and the usual rules for the PDF of a transformed variable.

Hope this helps.

per

unread,
Feb 27, 2009, 8:49:43 AM2/27/09
to
On Feb 24, 10:56 am, Peter Perkins

hi Peter,
can you please say more about the transformation? i'm not sure i am
following. what kind of transformation of the data would make it so i
don't have to give the location (mu) parameter, but just the
covariance matrix/correlation matrix (parameter C)?

Peter Perkins

unread,
Feb 27, 2009, 9:38:24 AM2/27/09
to
per wrote:

> can you please say more about the transformation? i'm not sure i am
> following. what kind of transformation of the data would make it so i
> don't have to give the location (mu) parameter, but just the
> covariance matrix/correlation matrix (parameter C)?

No transformation will do that; you will always have to specify the degrees of freedom parameter as well.

All you need to do to use MVT as a location/scale family is, separately for each column of your data, subtract the corresponding mean and divide by the corresponding scale factor. It sounds like you have the Statistics Toolbox. Take a look in stats/private/addtls.m; that code the handles the univariate t-location-scale distribution for the Distribution Fitting Tool is in there. Look at tlspdf and tlscdf. You need to do the same thing coordinate-wise.

Hope this helps.

Kevin Murphy

unread,
Nov 4, 2009, 2:21:04 PM11/4/09
to

You can just write your own function to compute it - see below.
Note that the mvtpdf function in the stats toolbox
first converts Sigma to a correlation matrix,
which is nonstandard (as far as I know).
Thus these two methods only
give the same results if Sigma has 1 on all the diagonals.

HTH
Kevin

function logp = mvtLogpdf(X, mu, Sigma, nu)
% Multivariate student T distribution, log pdf
% X(i,:) is i'th case
[N d] = size(X);
M = repmat(mu(:)', N, 1); % replicate the mean across rows
X = X-M;
mahal = sum((X*inv(Sigma)).*X,2); %#ok
logc = gammaln(nu/2 + d/2) - gammaln(nu/2) - 0.5*logdet(Sigma) ...
- (d/2)*log(nu) - (d/2)*log(pi);
logp = logc -(nu+d)/2*log1p(mahal/nu);

if 0
% this check only works if Sigma is a correlation matrix
logp2 = log(mvtpdf(X, Sigma, nu));
assert(approxeq(logp, logp2))
end


Peter Perkins <Peter.Perki...@mathworks.com> wrote in message <go8tt0$rma$1...@fred.mathworks.com>...

0 new messages