From: Kevin Murphy on 4 Nov 2009 14:21 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(a)mathworks.com> wrote in message <go8tt0$rma$1(a)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.
|
Pages: 1 Prev: Gigabit Ethernet Camera - jAi GigE Camera Next: mex linking error |