Multivariate distribution

Wishart distribution

A random positive-definite matrix: the scatter matrix of independent Normal() vectors, so times a sample covariance matrix (about a known zero mean). It is the matrix version of the chi-squared, used for the sampling distribution of covariance estimates and as the conjugate prior for the precision (inverse covariance) matrix of a multivariate normal. The plot shows the case: the joint density of the two diagonal entries , with the off-diagonal entry integrated out.

Joint density of (X₁, X₂)

051015051015x₁x₂mean (5, 5)

E[X₁] = 5 · E[X₂] = 5 · Var X₁ = 10 · Var X₂ = 10 · Cov = 3.6 · corr = 0.36

Formulas

Parameters
  • , the degrees of freedom (an integer for the scatter-matrix interpretation)
  • , a positive-definite scale matrix; here
Support
PDF
CDF
Mean
Variance

is the multivariate gamma function, . Each diagonal entry is . For , writing , integrating out gives the plotted density With and the Wishart is the chi-squared with degrees of freedom.

Worked example

Ten independent pairs are drawn from a bivariate normal with mean 0, standard deviations 2 and 1 and correlation 0.5, and . What are the mean and standard deviation of ?

with , so and Dividing by , the variance estimate has mean 4 and standard deviation 1.79: ten points pin a variance down only to within about 45%. answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.wishart(df=5, scale=[[1, 0.6], [0.6, 1]])
X.pdf([[5, 3], [3, 5]])  # density here: 0.004364
X.mean()
X.rvs(size=5, random_state=0)

rng = np.random.default_rng(0)
X.rvs(size=5, random_state=rng)

X.pdf takes the whole matrix, e.g. X.pdf([[5, 3], [3, 5]]). NumPy has no Wishart sampler; SciPy's rvs takes a NumPy generator as random_state.

Choosing between this and its neighbours? Which prior distribution should I use?

← Multivariate tInverse Wishart →