Skip to contents

Computes the (log) probability density of a correlation matrix under the LKJ (Lewandowski-Kurowicka-Joe) distribution. The LKJ distribution is parameterized by a shape parameter eta that controls the concentration around the identity matrix.

Usage

dlkjcorr(x, eta = 1, log = TRUE)

Source

These functions come from Richard McElreath's rethinking package and, judging by the source code, it seems that he got them from Ben Goodrich.

Arguments

x

A symmetric positive definite matrix with 1s on the diagonal (i.e., a correlation matrix)

eta

Numeric. Shape parameter controlling the concentration around the identity matrix. Must be positive. When eta = 1, the distribution is uniform over correlation matrices. As eta increases, more mass is placed on matrices closer to the identity matrix

log

Logical. If TRUE (default), returns the log-density. If FALSE, returns the density on the original scale

Value

Numeric value representing the (log) density of the correlation matrix under the LKJ distribution with the specified eta parameter

Details

The LKJ density is proportional to det(R)^(eta-1), where R is the correlation matrix. This function computes this density (or log-density). Note that this is the unnormalized density - the normalizing constant is not included.

References

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

See also