The Wishart distribution is a generalization of the univariate chi-square distribution to two or more variables. It is a distribution for symmetric positive semidefinite matrices, typically covariance matrices, the diagonal elements of which are each chi-square random variables. In the same way as the chi-square distribution can be constructed by summing the squares of independent, identically distributed, zero-mean univariate normal random variables, the Wishart distribution can be constructed by summing the inner products of independent, identically distributed, zero-mean multivariate normal random vectors. The Wishart distribution is often used as a model for the distribution of the sample covariance matrix for multivariate normal random data, after scaling by the sample size.
Only random matrix generation is supported for the Wishart distribution, including both singular and nonsingular Σ.
The Wishart distribution is parameterized with a symmetric, positive semidefinite matrix, Σ, and a positive scalar degrees of freedom parameter, ν. ν is analogous to the degrees of freedom parameter of a univariate chi-square distribution, and Σν is the mean of the distribution.
The probability density function of the d-dimensional Wishart distribution is given by
where X and Σ are d-by-d symmetric positive definite matrices, and ν is a scalar greater than d – 1. While it is possible to define the Wishart for singular Σ, the density cannot be written as above.
If x is a bivariate normal random vector with mean zero and covariance matrix
then you can use the Wishart distribution to generate a sample covariance matrix without explicitly generating x itself. Notice how the sampling variability is quite large when the degrees of freedom is small.
Sigma = [1 .5; .5 2]; df = 10; S1 = wishrnd(Sigma,df)/df S1 = 1.7959 0.64107 0.64107 1.5496 df = 1000; S2 = wishrnd(Sigma,df)/df S2 = 0.9842 0.50158 0.50158 2.1682