This is an old version, view current version.

28.1 Wishart distribution

28.1.1 Probability density function

If KN, ν(K1,), and SRK×K is symmetric and positive definite, then for symmetric and positive-definite WRK×K, Wishart(Wν,S)=12νK/2 1ΓK(ν2) |S|ν/2 |W|(νK1)/2 exp(12 tr(S1W)), where tr() is the matrix trace function, and ΓK() is the multivariate Gamma function, ΓK(x)=1πK(K1)/4 Kk=1Γ(x+1k2).

28.1.2 Sampling statement

W ~ wishart(nu, Sigma)

Increment target log probability density with wishart_lupdf(W | nu, Sigma).
Available since 2.0

28.1.3 Stan functions

real wishart_lpdf(matrix W | real nu, matrix Sigma)
Return the log of the Wishart density for symmetric and positive-definite matrix W given degrees of freedom nu and symmetric and positive-definite scale matrix Sigma.
Available since 2.12

real wishart_lupdf(matrix W | real nu, matrix Sigma)
Return the log of the Wishart density for symmetric and positive-definite matrix W given degrees of freedom nu and symmetric and positive-definite scale matrix Sigma dropping constant additive terms.
Available since 2.25

matrix wishart_rng(real nu, matrix Sigma)
Generate a Wishart variate with degrees of freedom nu and symmetric and positive-definite scale matrix Sigma; may only be used in transformed data and generated quantities blocks.
Available since 2.0