Description Usage Arguments Details Author(s) References Examples
View source: R/distributions.r
Functions for computing density and producing random samples from the LKJ onion method correlation matrix distribution.
1 2 |
x |
Matrix to compute probability density for |
eta |
Parameter controlling shape of distribution |
K |
Dimension of correlation matrix |
log |
If |
n |
Number of random matrices to sample |
The LKJ correlation matrix distribution is based upon work by Lewandowski, Kurowicka, and Joe. When the parameter eta
is equal to 1, it defines a flat distribution of correlation matrices. When eta > 1
, the distribution is instead concentrated towards to identity matrix. When eta < 1
, the distribution is more concentrated towards extreme correlations at -1 or +1.
It can be easier to understand this distribution if we recognize that the individual correlations within the matrix follow a beta distribution defined on -1 to +1. Thus eta
resembles theta
in the beta parameterization with a mean p and scale (sample size) theta.
The function rlkjcorr
returns an 3-dimensional array in which the first dimension indexes matrices. In the event that n=1
, it returns instead a single matrix.
Richard McElreath
Lewandowski, Kurowicka, and Joe. 2009. Generating random correlation matrices based on vines and extended onion method. Journal of Multivariate Analysis. 100:1989-2001.
Stan Modeling Language User's Guide and Reference Manual, v2.6.2
1 2 3 4 5 6 7 8 9 10 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.