# Wishart distribution

Notation $X \sim W_p(\mathbf{V},n)$ $n > p-1\!$ degrees of freedom (real) $\mathbf{V} > 0\,$ scale matrix ($p\times p$ pos. def) $\mathbf{X}\!$ $(p\times p)$ positive definite matrix $\frac{1}{2^\frac{np}{2}\left|{\mathbf V}\right|^\frac{n}{2}\Gamma_p(\frac{n}{2})} {\left|\mathbf{X}\right|}^{\frac{n-p-1}{2}} e^{-\frac{1}{2}{\rm tr}({\mathbf V}^{-1}\mathbf{X})}$ $\Gamma_p$ is the multivariate gamma function $\mathrm{tr}$ is the trace function $n \mathbf{V}$ $(n-p-1)\mathbf{V}\text{ for }n \geq p+1$ $\operatorname{Var}(\mathbf{X}_{ij}) = n(v_{ij}^2+v_{ii}v_{jj})$ see below $\Theta \mapsto \left|{\mathbf I} - 2i\,{\mathbf\Theta}{\mathbf V}\right|^{-n/2}$

In statistics, the Wishart distribution is a generalization to multiple dimensions of the chi-squared distribution, or, in the case of non-integer degrees of freedom, of the gamma distribution. It is named in honor of John Wishart, who first formulated the distribution in 1928.[1]

It is any of a family of probability distributions defined over symmetric, nonnegative-definite matrix-valued random variables (“random matrices”). These distributions are of great importance in the estimation of covariance matrices in multivariate statistics. In Bayesian statistics, the Wishart distribution is the conjugate prior of the inverse covariance-matrix of a multivariate-normal random-vector.

## Definition

Suppose X is an n × p matrix, each row of which is independently drawn from a p-variate normal distribution with zero mean:

$X_{(i)}{=}(x_i^1,\dots,x_i^p)^T\sim N_p(0,V).$

Then the Wishart distribution is the probability distribution of the p×p random matrix

$S=X^T X \,\!$

known as the scatter matrix. One indicates that S has that probability distribution by writing

$S\sim W_p(V,n).$

The positive integer n is the number of degrees of freedom. Sometimes this is written W(Vpn). For n ≥ p the matrix S is invertible with probability 1 if V is invertible.

If p = 1 and V = 1 then this distribution is a chi-squared distribution with n degrees of freedom.

## Occurrence

The Wishart distribution arises as the distribution of the sample covariance matrix for a sample from a multivariate normal distribution.[citation needed] It occurs frequently in likelihood-ratio tests in multivariate statistical analysis. It also arises in the spectral theory of random matrices[citation needed] and in multidimensional Bayesian analysis.[citation needed]

## Probability density function

The Wishart distribution can be characterized by its probability density function as follows:

Let $\mathbf{X}$ be a p × p symmetric matrix of random variables that is positive definite. Let $\mathbf{V}$ be a (fixed) positive definite matrix of size p × p.

Then, if np, $\mathbf{X}$ has a Wishart distribution with n degrees of freedom if it has a probability density function given by

$\frac{1}{2^\frac{np}{2}\left|{\mathbf V}\right|^\frac{n}{2}\Gamma_p(\frac{n}{2})} {\left|\mathbf{X}\right|}^{\frac{n-p-1}{2}} e^{-\frac{1}{2}{\rm tr}({\mathbf V}^{-1}\mathbf{X})}$

where Γp(·) is the multivariate gamma function defined as

$\Gamma_p(n/2)= \pi^{p(p-1)/4}\Pi_{j=1}^p \Gamma\left[ n/2+(1-j)/2\right].$

In fact the above definition can be extended to any real n > p − 1. If np − 1, then the Wishart no longer has a density—instead it represents a singular distribution that takes values in a lower-dimension subspace of the space of p × p matrices. [2]

## Use in Bayesian statistics

In Bayesian statistics, in the context of the multivariate normal distribution, the Wishart distribution is the conjugate prior to the precision matrix $\mathbf{\Omega} = \mathbf{\Sigma}^{-1}$, where $\mathbf{\Sigma}$ is the covariance matrix.

### Choice of W

The least informative, proper Wishart prior is obtained by setting $n = p$.

The prior mean of $W_p(\mathbf{V}, n)$ is $n\mathbf{V}^{-1}$. This implies that a good choice for $\mathbf{V}$ is $n\mathbf{\Sigma}_0$, where $\mathbf{\Sigma}_0$ is some prior guess for the covariance matrix.

## Properties

### Log-expectation

Note the following formula:[3]

$\operatorname{E}[\ln|\mathbf{X}|] = \sum_{i=1}^p \psi\left(\tfrac{1}{2}(n+1-i)\right) + p\ln(2) + \ln|\mathbf{V}|$

where ψ is the digamma function (the derivative of the log of the gamma function).

This plays a role in variational Bayes derivations for Bayes networks involving the Wishart distribution.

### Entropy

The information entropy of the distribution has the following formula:[3]

$\operatorname{H}[\mathbf{X}] = -\ln \left (B(\mathbf{V},n) \right ) -\tfrac{1}{2}(n-p-1) \operatorname{E}[\ln|\mathbf{X}|] + \frac{np}{2}$

where $B(\mathbf{V},n)$ is the normalizing constant of the distribution:

$B(\mathbf{V},n) = \frac{1}{\left|\mathbf{V}\right|^\frac{n}{2} 2^\frac{np}{2}\Gamma_p(\frac{n}{2})}$

This can be expanded as follows:

\begin{align} \operatorname{H}[\mathbf{X}] &= \tfrac{n}{2}\ln|\mathbf{V}| +\tfrac{np}{2}\ln(2) + \ln\left (\Gamma_p(\tfrac{n}{2}) \right ) -\tfrac{1}{2}(n-p-1) \operatorname{E}[\ln|\mathbf{X}|] + \tfrac{np}{2} \\ &= \tfrac{n}{2}\ln|\mathbf{V}| +\tfrac{np}{2}\ln(2) + \tfrac{1}{4} p(p-1) \ln(\pi) + \sum_{i=1}^p \ln \left (\Gamma\left ( \tfrac{n}{2}+\tfrac{1-i}{2}\right ) \right ) \\ &\qquad \qquad -\tfrac{1}{2}(n-p-1)\left(\sum_{i=1}^p \psi\left(\tfrac{1}{2}(n+1-i)\right) + p\ln(2) + \ln|\mathbf{V}|\right) + \tfrac{np}{2} \\ &= \tfrac{n}{2}\ln|\mathbf{V}| +\tfrac{np}{2}\ln(2) + \tfrac{1}{4} p(p-1) \ln(\pi) + \sum_{i=1}^p \ln \left (\Gamma\left ( \tfrac{n}{2}+\tfrac{1-i}{2}\right ) \right ) \\ &\qquad \qquad - \left ( \tfrac{1}{2}(n-p-1)\sum_{i=1}^p \psi\left(\tfrac{1}{2}(n+1-i)\right) + \tfrac{1}{2}(n-p-1)p\ln(2) + \tfrac{1}{2}(n-p-1)\ln|\mathbf{V}|\right) + \tfrac{np}{2} \\ &= \tfrac{p+1}{2}\ln|\mathbf{V}| +\tfrac{1}{2}p(p+1)\ln(2) + \tfrac{1}{4}p(p-1) \ln(\pi) + \sum_{i=1}^p \ln \left (\Gamma\left ( \tfrac{n}{2}+\tfrac{1-i}{2}\right ) \right ) -\tfrac{1}{2}(n-p-1)\sum_{i=1}^p \psi\left(\tfrac{1}{2}(n+1-i)\right) + \tfrac{np}{2} \end{align}

### Characteristic function

The characteristic function of the Wishart distribution is

$\Theta \mapsto \left|{\mathbf I} - 2i\,{\mathbf\Theta}{\mathbf V}\right|^{-\frac{n}{2}}.$

In other words,

$\Theta \mapsto \operatorname{E}\left [ \mathrm{exp}\left (i \mathrm{tr}(\mathbf{X}{\mathbf\Theta})\right )\right ] = \left|{\mathbf I} - 2i{\mathbf\Theta}{\mathbf V}\right|^{-\frac{n}{2}}$

where E[⋅] denotes expectation. (Here Θ and I are matrices the same size as V (I is the identity matrix); and i is the square root of −1).[4]

## Theorem

If a p × p random matrix $\mathbf{X}$ has a Wishart distribution with m degrees of freedom and variance matrix $\mathbf{V}$ — write $\mathbf{X}\sim\mathcal{W}_p({\mathbf V},m)$ — and $\mathbf{C}$ is a q × p matrix of rank q, then [5]

${\mathbf C}\mathbf{X}{\mathbf C}^T \sim \mathcal{W}_q\left({\mathbf C}{\mathbf V}{\mathbf C}^T,m\right).$

### Corollary 1

If ${\mathbf z}$ is a nonzero $p\times 1$ constant vector, then[5] ${\mathbf z}^T\mathbf{X}{\mathbf z}\sim\sigma_z^2\chi_m^2$.

In this case, $\chi_m^2$ is the chi-squared distribution and $\sigma_z^2={\mathbf z}^T{\mathbf V}{\mathbf z}$ (note that $\sigma_z^2$ is a constant; it is positive because ${\mathbf V}$ is positive definite).

### Corollary 2

Consider the case where ${\mathbf z}^T=(0,\ldots,0,1,0,\ldots,0)$ (that is, the jth element is one and all others zero). Then corollary 1 above shows that

$w_{jj}\sim\sigma_{jj}\chi^2_m$

gives the marginal distribution of each of the elements on the matrix's diagonal.

Noted statistician George Seber points out[citation needed] that the Wishart distribution is not called the “multivariate chi-squared distribution” because the marginal distribution of the off-diagonal elements is not chi-squared. Seber prefers[citation needed] to reserve the term multivariate for the case when all univariate marginals belong to the same family.

## Estimator of the multivariate normal distribution

The Wishart distribution is the sampling distribution of the maximum-likelihood estimator (MLE) of the covariance matrix of a multivariate normal distribution.[6] A derivation of the MLE uses the spectral theorem.

## Bartlett decomposition

The Bartlett decomposition of a matrix $\mathbf{X}$ from a p-variate Wishart distribution with scale matrix $\mathbf{V}$ and n degrees of freedom is the factorization:

$\mathbf{X} = {\textbf L}{\textbf A}{\textbf A}^T{\textbf L}^T$

where $\mathbf{L}$ is the Cholesky factor of $\mathbf{V}$, and:

$\mathbf A = \begin{pmatrix} c_1 & 0 & 0 & \cdots & 0\\ n_{21} & c_2 &0 & \cdots& 0 \\ n_{31} & n_{32} & c_3 & \cdots & 0\\ \vdots & \vdots & \vdots &\ddots & \vdots \\ n_{p1} & n_{p2} & n_{p3} &\cdots & c_p \end{pmatrix}$

where $c_i^2 \sim \chi^2_{n-i+1}$ and $n_{ij} \sim N(0,1) \,$ independently.[7] This provides a useful method for obtaining random samples from a Wishart distribution.[8]

## Marginal distribution of matrix elements

Let $\mathbf{V}$ be a 2 × 2 variance matrix characterized by correlation coefficient $-1 < \rho < 1$ and $\mathbf{L}$ its lower Cholesky factor:

$\mathbf{V} = \begin{pmatrix} \sigma_1^2 & \rho \sigma_1 \sigma_2 \\ \rho \sigma_1 \sigma_2 & \sigma_2^2 \end{pmatrix}, \qquad \mathbf{L} = \begin{pmatrix} \sigma_1 & 0 \\ \rho \sigma_2 & \sqrt{1-\rho^2} \sigma_2 \end{pmatrix}$

Multiplying through the Bartlett decomposition above, we find that a random sample from the 2 × 2 Wishart distribution is

$\mathbf{X} = \begin{pmatrix} \sigma_1^2 c_1^2 & \sigma_1 \sigma_2(\rho c_1^2 + \sqrt{1-\rho^2} c_1 n_{21}) \\ \sigma_1 \sigma_2(\rho c_1^2 + \sqrt{1-\rho^2} c_1 n_{21}) & \sigma_2^2 ((1-\rho^2) c_2^2 + (\sqrt{1-\rho^2} n_{21} + \rho c_1)^2) \end{pmatrix}$

The diagonal elements, most evidently in the first element, follow the $\chi^2$ distribution with n degrees of freedom (scaled by $\sigma^2$) as expected. The off-diagonal element is less familiar but can be identified as a normal variance-mean mixture where the mixing density is a $\chi^2$ distribution. The corresponding marginal probability density for the off-diagonal element is therefore the variance-gamma distribution

$f(x_{12}) = \frac{| x_{12} |^{\frac{n-1}{2}}}{\Gamma\left(\frac{n}{2}\right) \sqrt{2^{n-1} \pi (1-\rho^2)(\sigma_1 \sigma_2)^{n+1}}} \cdot K_{\frac{n-1}{2}} \left(\frac{|x_{12}|}{\sigma_1 \sigma_2 (1-\rho^2)}\right) \exp{\left(\frac{\rho x_{12}}{\sigma_1 \sigma_2 (1-\rho^2)}\right)}$

where $K_{\nu}(z)$ is the modified Bessel function of the second kind.[9] Similar results may be found for higher dimensions, but the interdependence of the off-diagonal correlations becomes increasingly complicated. It is also possible to write down the moment-generating function even in the noncentral case (essentially the nth power of Craig (1936)[10] equation 10) although the probability density becomes an infinite sum of Bessel functions.

## The possible range of the shape parameter

It can be shown [11] that the Wishart distribution can be defined if and only if the shape parameter n belongs to the set

$\Lambda_p:=\{0,\dots,p-1\}\cup \left(p-1,\infty\right).$

This set is named after Gindikin, who introduced it[12] in the seventies in the context of gamma distributions on homogeneous cones. However, for the new parameters in the discrete spectrum of the Gindikin ensemble, namely,

$\Lambda_p^*:=\{0,\dots,p-1\},$

the corresponding Wishart distribution has no Lebesgue density.

## References

1. ^ Wishart, J. (1928). "The generalised product moment distribution in samples from a normal multivariate population". Biometrika 20A (1–2): 32–52. doi:10.1093/biomet/20A.1-2.32. JFM 54.0565.02. JSTOR 2331939.
2. ^ Uhlig, H. (1994). "On Singular Wishart and Singular Multivariate Beta Distributions". The Annals of Statistics 22: 395. doi:10.1214/aos/1176325375. edit
3. ^ a b C.M. Bishop, Pattern Recognition and Machine Learning, Springer 2006, p. 693.
4. ^ Anderson, T. W. (2003). An Introduction to Multivariate Statistical Analysis (3rd ed.). Hoboken, N. J.: Wiley Interscience. p. 259. ISBN 0-471-36091-0.
5. ^ a b Rao, C. R., Linear statistical inference and its applications, Wiley 1965, p. 535.
6. ^ C. Chatfield and A. J. Collins, 1980,"Introduction to Multivariate Analysis" p.103-108
7. ^ Anderson, T. W. (2003). An Introduction to Multivariate Statistical Analysis (3rd ed.). Hoboken, N. J.: Wiley Interscience. p. 257. ISBN 0-471-36091-0.
8. ^ Smith, W. B.; Hocking, R. R. (1972). "Algorithm AS 53: Wishart Variate Generator". Journal of the Royal Statistical Society, Series C 21 (3): 341–345. JSTOR 2346290.
9. ^ Pearson, Karl; Jeffery, G. B.; Elderton, Ethel M. (December 1929). "On the Distribution of the First Product Moment-Coefficient, in Samples Drawn from an Indefinitely Large Normal Population". Biometrika (Biometrika Trust) 21: 164–201. doi:10.2307/2332556. JSTOR 2332556.
10. ^ Craig, Cecil C. (1936). "On the Frequency Function of xy". Ann. Math. Statist. 7: 1–15. doi:10.1214/aoms/1177732541.
11. ^ Peddada and Richards, Shyamal Das; Richards, Donald St. P. (1991). "Proof of a Conjecture of M. L. Eaton on the Characteristic Function of the Wishart Distribution,". Annals of Probability 19 (2): 868–874. doi:10.1214/aop/1176990455.
12. ^ Gindikin, S.G. (1975). "Invariant generalized functions in homogeneous domains,". Funct. Anal. Appl., 9 (1): 50–52. doi:10.1007/BF01078179.
13. ^ Paul S. Dwyer, “SOME APPLICATIONS OF MATRIX DERIVATIVES IN MULTIVARIATE ANALYSIS”, JASA 1967; 62:607-625, available JSTOR.
14. ^ C.M. Bishop, Pattern Recognition and Machine Learning, Springer 2006.