Operators and Keywords

C++ API

Function File: x = mvtrnd (sigma, nu)

Function File: x = mvtrnd (sigma, nu, n)

Generate random samples from the multivariate t-distribution.

#### Arguments

• sigma is the matrix of correlation coefficients. If there are any non-unit diagonal elements then sigma will be normalized, so that the resulting covariance of the obtained samples x follows: `cov (x) = nu/(nu-2) * sigma ./ (sqrt (diag (sigma) * diag (sigma)))`. In order to obtain samples distributed according to a standard multivariate t-distribution, sigma must be equal to the identity matrix. To generate multivariate t-distribution samples x with arbitrary covariance matrix sigma, the following scaling might be used: `x = mvtrnd (sigma, nu, n) * diag (sqrt (diag (sigma)))`.
• nu is the degrees of freedom for the multivariate t-distribution. nu must be a vector with the same number of elements as samples to be generated or be scalar.
• n is the number of rows of the matrix to be generated. n must be a non-negative integer and corresponds to the number of samples to be generated.

#### Return values

• x is a matrix of random samples from the multivariate t-distribution with n row samples.

#### Examples

```          sigma = [1, 0.5; 0.5, 1];
nu = 3;
n = 10;
x = mvtrnd (sigma, nu, n);

sigma = [1, 0.5; 0.5, 1];
nu = [2; 3];
n = 2;
x = mvtrnd (sigma, nu, 2);
```

#### References

1. Wendy L. Martinez and Angel R. Martinez. Computational Statistics Handbook with MATLAB. Appendix E, pages 547-557, Chapman & Hall/CRC, 2001.
2. Samuel Kotz and Saralees Nadarajah. Multivariate t Distributions and Their Applications. Cambridge University Press, Cambridge, 2004.

Package: statistics