>> help mvtrnd
mvtrnd Random matrices from the multivariate t distribution.
R = mvtrnd(C,DF,N) returns an NbyD matrix R of random numbers from
the multivariate t distribution with correlation parameters C and
degrees of freedom DF.
C is a symmetric, positive semidefinite, DbyD correlation matrix.
Note: mvtrnd computes random vectors from the standard multivariate
Student's t, centered at the origin, with no scale parameters. If
C is a covariance matrix, i.e. DIAG(C) is not all ones, mvtrnd
rescales C to transform it to a correlation matrix.
On 3/6/2012 4:49 PM, Pinar wrote:
> Dear Mr. Perkins,
>
> I would like to ask a question to clarify one point as it seems that I
> may be misinterpreting what you and the Matlab help menu have written
> regarding the scaling. And due to this I have been getting weird results
> from my program and I am almost sure that the problem has to do with the
> mvtrnd function in the program.
>
> If we want to draw from the multivariate t distribution with mean mu and
> variance sigma, you suggest the following:
>
> mu = repmat([row vector of componentwise means],n,1);
> sigma = repmat([row vector of componentwise scale factors],n,1);
> t = mu + sigma.*mvtrnd(C,df,n);
>
> Above, we multiply our draw from the multivariate distribution that we
> get using mvtrnd(C,df,n) with sigma because the variance we want in this
> case is sigma^2. What I do not understand is the following:
>
> Aren't we already incorporating the variance (here, sigma^2) by using C
> in the mvtrnd function? So, when we multiply it with also sigma, isn't
> is like double counting? Or what you meant was indeed that C is an
> identity matrix (so that once we multiply mvtrnd(C,df,n) with sigma, we
> get draws from multivariate distribution with variance sigma^2)? Or, in
> short, doesn't mvtrnd(C,df,n) produce draws from multivariate t
> distribution with mean zero and variance C??
>
> Thank you very much.
>
> I would be appreciated if you could help me.
>
> Kind regards
>
> Pinar
>
>
> Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message
> <hpj8gm$mul$1@fred.mathworks.com>...
>> On 4/7/2010 7:55 PM, Firat wrote:
>>
>> > Is there any way to add a mean for this
>> > function so that I can get my random numbers based on tdistribution,
>> > but around my data mean instead of zero ? or is there any method like
>> > scaling, or translation to do that ?
>>
>> Firat, MVTRND won't do that, but it's easy to do:
>>
>> mu = [row vector of componentwise means];
>> sigma = [row vector of componentwise scale factors];
>> t = bsxfun(@sum,mu,bsxfun(@times,sigma,mvtrnd(C,df,n)));
>>
>> That probably looks a bit cryptic; you could also do this
>>
>> mu = repmat([row vector of componentwise means],n,1);
>> sigma = repmat([row vector of componentwise scale factors],n,1);
>> t = mu + sigma.*mvtrnd(C,df,n);
>>
>> Hope this helps.
