Thread Subject: multivariate student t distribution pdf in matlab?

Subject: multivariate student t distribution pdf in matlab?

From: per

Date: 24 Feb, 2009 14:38:43

Message: 1 of 5

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.

Subject: multivariate student t distribution pdf in matlab?

From: Peter Perkins

Date: 24 Feb, 2009 15:56:54

Message: 2 of 5

per wrote:

> 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?

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.

Subject: multivariate student t distribution pdf in matlab?

From: per

Date: 27 Feb, 2009 13:49:43

Message: 3 of 5

On Feb 24, 10:56=A0am, Peter Perkins
<Peter.PerkinsRemoveT...@mathworks.com> wrote:
> per wrote:
> > 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?
>
> 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 transform=
ation does the trick. =A0It's easy to compute the PDF for such a thing by u=
nscaling and unshifting your data, then using MVTPDF and the usual rules fo=
r the PDF of a transformed variable.
>
> Hope this helps.

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)?

Subject: multivariate student t distribution pdf in matlab?

From: Peter Perkins

Date: 27 Feb, 2009 14:38:24

Message: 4 of 5

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.

Subject: multivariate student t distribution pdf in matlab?

From: Kevin Murphy

Date: 4 Nov, 2009 19:21:04

Message: 5 of 5


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.PerkinsRemoveThis@mathworks.com> wrote in message <go8tt0$rma$1@fred.mathworks.com>...
> 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.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com