WishartMatrixDistribution[ν,Σ]
represents a Wishart matrix distribution with ν degrees of freedom and covariance matrix Σ.
WishartMatrixDistribution
WishartMatrixDistribution[ν,Σ]
represents a Wishart matrix distribution with ν degrees of freedom and covariance matrix Σ.
Details
- WishartMatrixDistribution is the distribution of the sample covariance from ν independent realizations of a multivariate Gaussian distribution with covariance matrix Σ when the degrees of freedom parameter ν is an integer.
- WishartMatrixDistribution is also known as Wishart–Laguerre ensemble.
- The probability density for a symmetric matrix
in a Wishart matrix distribution is proportional to
, where
is the size of matrix Σ. - The covariance matrix
can be any positive definite symmetric matrix of dimensions
and ν can be any real number greater than
. - WishartMatrixDistribution can be used with such functions as MatrixPropertyDistribution, EstimatedDistribution, and RandomVariate.
Examples
open all close allBasic Examples (3)
Generate a pseudorandom matrix:
RandomVariate[WishartMatrixDistribution[10, {{1, 1 / 3}, {1 / 3, 1}}]]Check that it is symmetric and positive definite:
SymmetricMatrixQ[%]∧PositiveDefiniteMatrixQ[%]Sample eigenvalues of a Wishart random matrix using MatrixPropertyDistribution:
𝒟 = MatrixPropertyDistribution[RandomSample[Eigenvalues[𝓂]], 𝓂WishartMatrixDistribution[10, {{1, 1 / 3}, {1 / 3, 1}}]];Estimate joint distribution of eigenvalues:
SmoothHistogram3D[RandomVariate[𝒟, 10 ^ 4], PlotRange -> {{-1, 30}, {-1, 30}, Automatic}]Mean[WishartMatrixDistribution[3, DiagonalMatrix[{2, 1, 3}]]]//MatrixFormVariance[WishartMatrixDistribution[3, DiagonalMatrix[{2, 1, 3}]]]//MatrixFormScope (6)
Generate a single pseudorandom matrix:
RandomVariate[WishartMatrixDistribution[10, {{1, 1 / 3}, {1 / 3, 1}}]]Generate a set of pseudorandom matrices:
MatrixForm /@ RandomVariate[WishartMatrixDistribution[10, {{1, 1 / 3}, {1 / 3, 1}}], 3]RandomVariate[WishartMatrixDistribution[10, {{1, 1 / 3}, {1 / 3, 1}}], WorkingPrecision -> 20]Compute statistical properties numerically:
λmax𝒟 = MatrixPropertyDistribution[Max[Eigenvalues[𝓂]], 𝓂WishartMatrixDistribution[10, {{1, 1 / 3}, {1 / 3, 1}}]];Numerically approximate expectation of the largest matrix eigenvalue
:
NExpectation[λmax, λmaxλmax𝒟]Distribution parameters estimation:
dist = WishartMatrixDistribution[2, IdentityMatrix[2]];
sample = RandomVariate[dist, 10 ^ 2];Estimate the distribution parameters from sample data:
edist = EstimatedDistribution[sample, WishartMatrixDistribution[ν, Array[c, {2, 2}]]]Compare LogLikelihood for both distributions:
LogLikelihood[#, sample]& /@ {edist, dist}Skewness[WishartMatrixDistribution[3, {{2, 1}, {1, 3}}]]//MatrixFormKurtosis[WishartMatrixDistribution[3, {{2, 1}, {1, 3}}]]//MatrixFormApplications (2)
When n and p (the dimension of the covariance matrix Σ) are both large, the scaled largest eigenvalue of a matrix from a Wishart ensemble with identity covariance is approximately distributed as a Tracy–Widom distribution:
λmax𝒟[n_, p_] := With[{a = (Sqrt[n - 1 / 2] + Sqrt[p - 1 / 2])^2, b = (Sqrt[n] + Sqrt[p])((1/Sqrt[n - 1 / 2]) + (1/Sqrt[p - 1 / 2]))^1 / 3}, MatrixPropertyDistribution[(1/b)(Max[Eigenvalues[𝓂]] - a), 𝓂WishartMatrixDistribution[n, IdentityMatrix[p]]]]Sample the scaled largest eigenvalue:
data = RandomVariate[λmax𝒟[1000, 512], 250];Check goodness of fit with TracyWidomDistribution:
DistributionFitTest[data, TracyWidomDistribution[1]]Show[Histogram[data, Automatic, PDF], Plot[PDF[TracyWidomDistribution[1], x], {x, -5, 3}, PlotStyle -> Thick]]Algebraically independent components of a symmetric Wishart matrix have a known PDF:
WishartIndependentMatrixElementsDistribution[WishartMatrixDistribution[n_Integer, covS_ ? SquareMatrixQ]] := Block[{𝓍, p = Length[covS], sm, nf},
sm = Array[𝓍[Min[##], Max[##]]&, {p, p}];
nf = 2^n p / 2π^p(p - 1) / 4Det[covS]^n / 2Underoverscript[∏, i, p]Gamma[(1/2) (n + 1 - i)];
ProbabilityDistribution[Piecewise[{{(1/nf)Det[sm]^(n - p - 1) / 2Exp[-(1/2)Tr[Inverse[covS].sm]], pdCond[sm]}}], pdDom[sm, p]]
]pdDom[mat_, p_] := Block[{diag = Diagonal[mat], dom, pos, bm},
dom = {#, 0, Infinity}& /@ diag;
pos = Subsets[Range[p], {2}];
bm = KroneckerProduct[#, #]&[Sqrt[diag]];
Sequence @@Join[dom, MapThread[{#1, -#2, #2}&, {Extract[mat, pos], Extract[bm, pos]}]]]pdCond[mat_] := Refine[DistributionParameterAssumptions[MultinormalDistribution[First[mat], mat]], Element[First[mat], Reals]]Build the distribution of independent components of a
Wishart matrix:
wmd = WishartMatrixDistribution[5, {{1, 1 / 3}, {1 / 3, 2}}];icd = WishartIndependentMatrixElementsDistribution[wmd]Find the joint distribution of a diagonal element:
diagPDF = PDF[MarginalDistribution[icd, {1, 2}], {d1, d2}]Use MatrixPropertyDistribution to sample diagonal elements of Wishart matrices:
diags = RandomVariate[MatrixPropertyDistribution[Diagonal[𝓂], 𝓂wmd], 10 ^ 3];DistributionFitTest[diags, ProbabilityDistribution[diagPDF, {d1, 0, Infinity}, {d2, 0, Infinity}]]Show[Histogram3D[diags, Automatic, PDF], Plot3D[diagPDF, {d1, 0, 30}, {d2, 0, 40}, PlotStyle -> None, MeshStyle -> Thick, PlotRange -> All]]Properties & Relations (4)
Use MatrixPropertyDistribution to represent the scaled eigenvalues of a Wishart random matrix with identity covariance:
eigvsDist[n_, p_] := MatrixPropertyDistribution[Eigenvalues[x] / n, xWishartMatrixDistribution[n, IdentityMatrix[p]]]The limiting distribution of eigenvalues follows MarchenkoPasturDistribution:
data = RandomVariate[eigvsDist[1000, 200]];edist = EstimatedDistribution[data, MarchenkoPasturDistribution[lambda, sigma]]Compare the histogram of the eigenvalues with the PDF:
Show[Histogram[data, Automatic, PDF], Plot[PDF[edist, x], {x, 0, Max[data] + 1}, PlotStyle -> Thick, Exclusions -> None]]The expression
, where
and
are, respectively, an independent Gaussian vector and Wishart matrix, follows HotellingTSquareDistribution:
cov = {{1, 2 / 5}, {2 / 5, 1 / 2}};
n = 10;
t2dist = HotellingTSquareDistribution[Length[cov], n];Use MatrixPropertyDistribution to sample expressions
:
sample = RandomVariate[MatrixPropertyDistribution[n x.Inverse[m].x, {mWishartMatrixDistribution[n, cov], xMultinormalDistribution[{0, 0}, cov]}], 10 ^ 4];DistributionFitTest[sample, t2dist]Show[Histogram[sample, Automatic, PDF], Plot[PDF[t2dist, x], {x, 0, 12}]]Diagonal elements of a Wishart random matrix each follow a scaled χ2 distribution:
n = 10;
sigma = {{2, 4 / 5}, {4 / 5, 7 / 6}};
diags = RandomVariate[MatrixPropertyDistribution[Diagonal[m], mWishartMatrixDistribution[n, sigma]], 10 ^ 4];Test against applicably scaled χ2 distributions:
dist1 = TransformedDistribution[2 * x, xChiSquareDistribution[n]];DistributionFitTest[diags[[All, 1]], dist1]dist2 = TransformedDistribution[7 / 6 * x, xChiSquareDistribution[n]];DistributionFitTest[diags[[All, 2]], dist2]Diagonal elements are not independent:
ListPlot[diags, PlotRange -> All]IndependenceTest[diags[[All, 1]], diags[[All, 2]], "TestConclusion"]For any nonzero vector
and Wishart matrix
with scale matrix
,
is χ2 distributed:
Σ = {{1, 4 / 5}, {4 / 5, 1}};
n = 10.3;
y = # / Sqrt[#.Σ.#]&[RandomReal[1, 2]];
data = RandomVariate[MatrixPropertyDistribution[y.w.y, wWishartMatrixDistribution[n, Σ]], 10 ^ 4];DistributionFitTest[data, ChiSquareDistribution[n]]Show[Histogram[data, Automatic, PDF], Plot[PDF[ChiSquareDistribution[n], x], {x, 0, 30}]]Related Guides
Text
Wolfram Research (2015), WishartMatrixDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/WishartMatrixDistribution.html (updated 2017).
CMS
Wolfram Language. 2015. "WishartMatrixDistribution." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/WishartMatrixDistribution.html.
APA
Wolfram Language. (2015). WishartMatrixDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WishartMatrixDistribution.html
BibTeX
@misc{reference.wolfram_2026_wishartmatrixdistribution, author="Wolfram Research", title="{WishartMatrixDistribution}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/WishartMatrixDistribution.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_wishartmatrixdistribution, organization={Wolfram Research}, title={WishartMatrixDistribution}, year={2017}, url={https://reference.wolfram.com/language/ref/WishartMatrixDistribution.html}, note=[Accessed: 13-June-2026]}