This is an old version, view current version.

24.1 LKJ Correlation Distribution

24.1.1 Probability Density Function

For \(\eta > 0\), if \(\Sigma\) a positive-definite, symmetric matrix with unit diagonal (i.e., a correlation matrix), then \[ \text{LkjCorr}(\Sigma|\eta) \propto \det \left( \Sigma \right)^{(\eta - 1)}. \] The expectation is the identity matrix for any positive value of the shape parameter \(\eta\), which can be interpreted like the shape parameter of a symmetric beta distribution:

  • if \(\eta = 1\), then the density is uniform over correlation matrices of order \(K\);

  • if \(\eta > 1\), the identity matrix is the modal correlation matrix, with a sharper peak in the density at the identity matrix for larger \(\eta\); and

  • for \(0 < \eta < 1\), the density has a trough at the identity matrix.

  • if \(\eta\) were an unknown parameter, the Jeffreys prior is proportional to \(\sqrt{2\sum_{k=1}^{K-1}\left( \psi_1\left(\eta+\frac{K-k-1}{2}\right) - 2\psi_1\left(2\eta+K-k-1 \right)\right)}\), where \(\psi_1()\) is the trigamma function

See (Lewandowski, Kurowicka, and Joe 2009) for definitions. However, it is much better computationally to work directly with the Cholesky factor of \(\Sigma\), so this distribution should never be explicitly used in practice.

24.1.2 Sampling Statement

y ~ lkj_corr(eta)

Increment target log probability density with lkj_corr_lpdf( y | eta) dropping constant additive terms.

24.1.3 Stan Functions

real lkj_corr_lpdf(matrix y | real eta)
The log of the LKJ density for the correlation matrix y given nonnegative shape eta. The only reason to use this density function is if you want the code to run slower and consume more memory with more risk of numerical errors. Use its Cholesky factor as described in the next section.

matrix lkj_corr_rng(int K, real eta)
Generate a LKJ random correlation matrix of order K with shape eta; may only be used in generated quantities block

References

Lewandowski, Daniel, Dorota Kurowicka, and Harry Joe. 2009. “Generating Random Correlation Matrices Based on Vines and Extended Onion Method.” Journal of Multivariate Analysis 100: 1989–2001.