pymc.Wishart#
- class pymc.Wishart(name, *args, rng=None, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, default_transform=UNSET, **kwargs)[source]#
Wishart distribution.
The Wishart distribution is the probability distribution of the maximum-likelihood estimator (MLE) of the precision matrix of a multivariate normal distribution. If V=1, the distribution is identical to the chi-square distribution with nu degrees of freedom.
\[f(X \mid nu, T) = \frac{{\mid T \mid}^{nu/2}{\mid X \mid}^{(nu-k-1)/2}}{2^{nu k/2} \Gamma_p(nu/2)} \exp\left\{ -\frac{1}{2} Tr(TX) \right\}\]where \(k\) is the rank of \(X\).
Support
\(X(p x p)\) positive definite matrix
Mean
\(nu V\)
Variance
\(nu (v_{ij}^2 + v_{ii} v_{jj})\)
- Parameters:
- nutensor_like of
int Degrees of freedom, > 0.
- Vtensor_like of
float p x p positive definite matrix.
- nutensor_like of
Notes
The Wishart distribution is generally unusable as a prior distribution for MCMC sampling. The probability of sampling a symmetric positive definite matrix is effectively zero, since MCMC proposals in unconstrained space almost never land exactly on the SPD manifold.
For modeling covariance matrices, you should instead use
LKJCholeskyCovorLKJCorr.However, the Wishart distribution may be used as a likelihood with
observedin some cases, where the distribution is evaluated at fixed observed values rather than sampled during MCMC.Methods
Wishart.dist(nu, V, *args, **kwargs)Create a tensor variable corresponding to the cls distribution.