pymc.WishartBartlett#

pymc.WishartBartlett(name, S, nu, is_cholesky=False, return_cholesky=False, initval=None)[source]#

Bartlett decomposition of the Wishart distribution. As the Wishart distribution requires the matrix to be symmetric positive semi-definite it is impossible for MCMC to ever propose acceptable matrices.

Instead, we can use the Barlett decomposition which samples a lower diagonal matrix. Specifically:

\[ \begin{align}\begin{aligned}\begin{split}\text{If} L \sim \begin{pmatrix} \sqrt{c_1} & 0 & 0 \\ z_{21} & \sqrt{c_2} & 0 \\ z_{31} & z_{32} & \sqrt{c_3} \end{pmatrix}\end{split}\\\begin{split}\text{with} c_i \sim \chi^2(n-i+1) \text{ and } n_{ij} \sim \mathcal{N}(0, 1), \text{then} \\ L \times A \times A.T \times L.T \sim \text{Wishart}(L \times L.T, \nu)\end{split}\end{aligned}\end{align} \]

See http://en.wikipedia.org/wiki/Wishart_distribution#Bartlett_decomposition for more information.

Parameters:
Sndarray

p x p positive definite matrix Or: p x p lower-triangular matrix that is the Cholesky factor of the covariance matrix.

nutensor_like of int

Degrees of freedom, > dim(S).

is_choleskybool, default=False

Input matrix S is already Cholesky decomposed as S.T * S

return_choleskybool, default=False

Only return the Cholesky decomposed matrix.

initvalndarray

p x p positive definite matrix used to initialize

Notes

This is not a standard Distribution class but follows a similar interface. Besides the Wishart distribution, it will add RVs name_c and name_z to your model which make up the matrix.

This distribution is usually a bad idea to use as a prior for multivariate normal. You should instead use LKJCholeskyCov or LKJCorr.