362ae1c3创建于 2022年6月24日历史提交

Wishart distribution

A Wishart random variable.

Notes

The Wishart distribution is often denoted:

.. math::

W_p(\nu , \Sigma )

where :math:\nu is the degrees of freedom and :math:\Sigma is the :math:p \times p scale matrix, and :math:scale must be a symmetric positive definite matrix.

if :math:S \sim W_p(\nu , \Sigma ), its PDF is given by:

.. math::

f(S) = \frac{|S|^{\frac{\nu -p-1}{2} }}{2^{\frac{\nu p}{2}} |\Sigma|^{\frac{\nu}{2} \Gamma _p(\frac{\nu}{2} )}}
\exp(-\operatorname{tr}(\Sigma^{-1}S)/2) 

if :math:S \sim W_p(\nu , \Sigma ), then :math:S^{-1} \sim W^{-1}_{p}(\nu , \Sigma^{-1} ) (inverse Wishart). and the Wishart distribution :math:W_1(\nu , 1) collapses to the :math:\chi ^{2}(\nu) distribution.

Examples

Compute the logpdf of Wishart distribution on vector.

::

let x = vector([0.24197072, 0.2186801, 0.17771369, 0.1375705])
let res = wishartLogPDF(x, 3, 1.0)

Result: :math:[-1.74939317, -1.78835126, -1.87158613, -1.97953317]

Methods

=================================== ================================= Method Description =================================== ================================= wishartLogPDF(x, df, cov) Log of probability density function wishartPDF(x, df, cov) Probability density function. =================================== =================================