23.2 Cholesky LKJ Correlation Distribution
Stan provides an implicit parameterization of the LKJ correlation
matrix density in terms of its Cholesky factor, which you should use
rather than the explicit parameterization in the previous section. For
example, if L
is a Cholesky factor of a correlation matrix, then
L ~ lkj_corr_cholesky(2.0); # implies L * L' ~ lkj_corr(2.0);
Because Stan requires models to have support on all valid constrained
parameters, L
will almost always4 be a parameter declared
with the type of a Cholesky factor for a correlation matrix; for
example,
parameters { cholesky_factor_corr[K] L; # rather than corr_matrix[K] Sigma; // ...
23.2.1 Probability Density Function
For \(\eta > 0\), if \(L\) is a \(K \times K\) lower-triangular Cholesky factor of a symmetric positive-definite matrix with unit diagonal (i.e., a correlation matrix), then \[ \text{LkjCholesky}(L|\eta) \propto \left|J\right|\det(L L^\top)^{(\eta - 1)} = \prod_{k=2}^K L_{kk}^{K-k+2\eta-2}. \] See the previous section for details on interpreting the shape parameter \(\eta\). Note that even if \(\eta=1\), it is still essential to evaluate the density function because the density of \(L\) is not constant, regardless of the value of \(\eta\), even though the density of \(LL^\top\) is constant iff \(\eta=1\).
A lower triangular \(L\) is a Cholesky factor for a correlation matrix if and only if \(L_{k,k} > 0\) for \(k \in 1{:}K\) and each row \(L_k\) has unit Euclidean length.
23.2.2 Sampling Statement
L ~
lkj_corr_cholesky
(eta)
Increment target log probability density with lkj_corr_cholesky_lpdf(L | eta)
dropping constant additive terms.
23.2.3 Stan Functions
real
lkj_corr_cholesky_lpdf
(matrix L | real eta)
The log of the LKJ density for the lower-triangular Cholesky factor L
of a correlation matrix given shape eta.
matrix
lkj_corr_cholesky_rng
(int K, real eta)
Generate a random Cholesky factor of a correlation matrix of order K
that is distributed LKJ with shape eta; may only be used in transformed data
and generated quantities blocks