Function Repository Resource:

WishartDistribution

Source Notebook

Represent the Wishart distribution

Contributed by: Wolfram Research

ResourceFunction["WishartDistribution"][Σ,m]

represents a Wishart distribution with scale matrix Σ and degrees of freedom parameter m.

Details and Options

The probability density for a symmetric positive definite matrix x in a Wishart distribution is proportional to .
The scale matrix Σ can be any symmetric positive definite matrix. The parameter m can be any number such that m>Length[Σ].
For integer m, the Wishart distribution gives the distribution of covariance matrices of multinormal samples.
ResourceFunction["WishartDistribution"] can be used with such functions as Mean, PDF and RandomReal.

Examples

Basic Examples (3) 

The mean of a Wishart distribution:

In[1]:=
Mean[ResourceFunction[
  "WishartDistribution"][{{Subscript[\[Sigma], 11]^2, \[Rho]*Subscript[\[Sigma], 11]*Subscript[\[Sigma], 22]}, {\[Rho]*Subscript[\[Sigma], 11]*Subscript[\[Sigma], 22], Subscript[\[Sigma], 22]^2}}, 10]]
Out[1]=

The variance:

In[2]:=
Variance[
 ResourceFunction[
  "WishartDistribution"][{{Subscript[\[Sigma], 11]^2, \[Rho]*Subscript[\[Sigma], 11]*Subscript[\[Sigma], 22]}, {\[Rho]*Subscript[\[Sigma], 11]*Subscript[\[Sigma], 22], Subscript[\[Sigma], 22]^2}}, 10]]
Out[2]=

Probability density function:

In[3]:=
PDF[ResourceFunction[
  "WishartDistribution"][{{1, \[Rho]}, {\[Rho], 1}}, 10], {{Subscript[x, 11], Subscript[x, 12]}, {Subscript[x, 12], Subscript[x, 22]}}]
Out[3]=

Scope (3) 

Generate a set of pseudorandom matrices that follow a Wishart distribution:

In[4]:=
RandomReal[
 ResourceFunction["WishartDistribution"][{{1, 1/3}, {1/3, 1}}, 5], 5]
Out[4]=

In[5]:=
Skewness[
 ResourceFunction["WishartDistribution"][{{1, 1/3}, {1/3, 1}}, 5]]
Out[5]=

In[6]:=
Kurtosis[
 ResourceFunction["WishartDistribution"][{{1, 1/3}, {1/3, 1}}, 5]]
Out[6]=

Possible Issues (2) 

WishartDistribution is not defined when Σ is not symmetric and positive definite:

In[7]:=
Mean[ResourceFunction["WishartDistribution"][{{1, 2}, {0, 1}}, 5]]
Out[7]=

WishartDistribution is not defined when m<Length[Σ]:

In[8]:=
Mean[ResourceFunction["WishartDistribution"][{{1, 0}, {0, 1}}, 1]]
Out[8]=

Substitution of invalid parameters into symbolic outputs gives results that are not meaningful:

In[9]:=
Mean[ResourceFunction[
   "WishartDistribution"][{{Subscript[s, 11], Subscript[s, 12]}, {Subscript[s, 12], Subscript[s, 22]}}, m]] /. {Subscript[s,
    11] -> 1, Subscript[s, 22] -> 1, Subscript[s, 12] -> 0, m -> I}
Out[9]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 06 February 2019

License Information