LKJ correlation distribution in Stan

Jake Jing
3 min readAug 10, 2021

Lewandowski-Kurowicka-Joe (LKJ) distribution is a very useful prior distribution for parameter estimation in correlation matrices, and is also tightly related to matrix factorizations such as Cholesky decomposition. For example, when you use Cholesky decomposition to decompose a variance-covariance matrix (Sigma​) into the multiplication of 3 matrices, you can set LKJCorr​ prior for the correlation matrix R.

Relationship between variance-covariance matrix (Sigma) and correlation matrix (R)

1. Form

Its probability density function is defined as:

where c_d is the normalizing constant for the dimension d​, and can be represented in the following equation (see Lewandowski et al. 2009 for details).

The LKJCorr prior is used for a positive-definite, symmetric matrix with unit diagonal (i.e., a correlation matrix (R) with main diagonal as 1 and off the diagonal elements as rho). The shape parameter eta is used to determine the shape of the probability density function. It can be interpreted like the shape parameter of a symmetric beta distribution (see the stan function reference).

  • if eta = 1, then the density is uniform over correlation matrices of a given order K (the number of row/column). This suggest we do not know whether there is a correlation or not. The correlation values can be anything between 0 and 1.
  • if eta > 1, the correlation…

--

--