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 over symmetric positive-definite matrices that arises as the distribution of the sum of outer products of i.i.d. multivariate normal vectors. If \(x_i \sim \mathcal{N}(0, V)\) are i.i.d. for \(i = 1, \dots, \nu\), then \(X = \sum_i x_i x_i^\top \sim \mathrm{Wishart}_p(\nu, V)\).

\[f(X \mid \nu, V) = \frac{|X|^{(\nu-p-1)/2}}{2^{\nu p / 2} |V|^{\nu / 2} \Gamma_p(\nu / 2)} \exp\left\{ -\frac{1}{2} \operatorname{tr}(V^{-1} X) \right\}\]

where \(p\) is the rank of \(X\).

Support

\(X\,(p \times p)\) positive definite matrix

Mean

\(\nu V\)

Variance

\(\nu (v_{ij}^2 + v_{ii} v_{jj})\)

Parameters:
nutensor_like of int

Degrees of freedom, must satisfy nu > p - 1.

Vtensor_like of float, optional

(p, p) symmetric positive-definite scale matrix. Mutually exclusive with scale_chol.

scale_choltensor_like of float, optional

(p, p) lower-triangular Cholesky factor of the scale matrix (V = scale_chol @ scale_chol.T). Provide this when you already have the decomposition to avoid a redundant Cholesky inside logp. Mutually exclusive with V.

Notes

The default unconstraining transform is CholeskyCovTransform, which parameterizes X = L @ L.T from a free real vector with log L_kk on the diagonal.

Methods

Wishart.dist(nu[, V, scale_chol])

Create a tensor variable corresponding to the cls distribution.