Main Content

The probability density function of the *d*-dimensional Inverse
Wishart distribution is given by

$$y=f({\rm X},\Sigma ,\nu )=\frac{{\left|T\right|}^{\left(\nu /2\right)}{e}^{\left(-\frac{1}{2}\text{trace}\left(T{X}^{-1}\right)\right)}}{{2}^{(\nu d)/2}{\pi}^{(d(d-1))/4}{\left|X\right|}^{(\nu +d+1)/2}\Gamma \left(\nu /2\right)\mathrm{...}\Gamma (\nu -(d-1))/2},$$

where *X* and *T* are
*d*-by-*d* symmetric positive definite
matrices, and *ν* is a scalar greater than or equal to
*d*. While it is possible to define the Inverse Wishart for
singular *Τ*, the density cannot be written as above.

If a random matrix has a Wishart distribution with parameters
*T*^{–1} and *ν*, then
the inverse of that random matrix has an inverse Wishart distribution with
parameters *Τ* and *ν*. The mean of the
distribution is given by

$$\frac{1}{\nu -d-1}T$$

where *d* is the number of rows and columns in
*T*.

Only random matrix generation is supported for the inverse Wishart, including both
singular and nonsingular *T*.

The inverse Wishart distribution is based on the Wishart distribution. In Bayesian statistics it is used as the conjugate prior for the covariance matrix of a multivariate normal distribution.

Notice that the sampling variability is quite large when the degrees of freedom is small.

Tau = [1 .5; .5 2]; df = 10; S1 = iwishrnd(Tau,df)*(df-2-1) S1 = 1.7959 0.64107 0.64107 1.5496 df = 1000; S2 = iwishrnd(Tau,df)*(df-2-1) S2 = 0.9842 0.50158 0.50158 2.1682