25.1 Wishart Distribution
25.1.1 Probability Density Function
If K∈N, ν∈(K−1,∞), and S∈RK×K is symmetric and positive definite, then for symmetric and positive-definite W∈RK×K, Wishart(W|ν,S)=12νK/2 1ΓK(ν2) |S|−ν/2 |W|(ν−K−1)/2 exp(−12 tr(S−1W)), where tr() is the matrix trace function, and ΓK() is the multivariate Gamma function, ΓK(x)=1πK(K−1)/4 K∏k=1Γ(x+1−k2).
25.1.2 Sampling Statement
W ~
wishart
(nu, Sigma)
Increment target log probability density with wishart_lpdf( W | nu, Sigma)
dropping constant additive terms.
25.1.3 Stan Functions
real
wishart_lpdf
(matrix W | real nu, matrix Sigma)
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
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
generated quantities block