pymc.LKJCorr#

class pymc.LKJCorr(name, *args, rng=None, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs)[source]#

The LKJ (Lewandowski, Kurowicka and Joe) log-likelihood.

The LKJ distribution is a prior distribution for correlation matrices. If eta = 1 this corresponds to the uniform distribution over correlation matrices. For eta -> oo the LKJ prior approaches the identity matrix.

Support

Upper triangular matrix with values in [-1, 1]

Parameters
n: int

Dimension of the covariance matrix (n > 1).

eta: float

The shape parameter (eta > 0) of the LKJ distribution. eta = 1 implies a uniform distribution of the correlation matrices; larger values put more weight on matrices with few correlations.

Notes

This implementation only returns the values of the upper triangular matrix excluding the diagonal. Here is a schematic for n = 5, showing the indexes of the elements:

[[- 0 1 2 3]
 [- - 4 5 6]
 [- - - 7 8]
 [- - - - 9]
 [- - - - -]]

References

LKJ2009

Lewandowski, D., Kurowicka, D. and Joe, H. (2009). “Generating random correlation matrices based on vines and extended onion method.” Journal of multivariate analysis, 100(9), pp.1989-2001.

Methods

LKJCorr.__init__(*args, **kwargs)

LKJCorr.dist(n, eta, **kwargs)

Creates a tensor variable corresponding to the cls distribution.

LKJCorr.logp(n, eta)

Calculate log-probability of LKJ distribution at specified value.

LKJCorr.moment(*args)

Attributes

bound_args_indices

rv_class

rv_op