Equivalence between lkj_corr_lpdf(matrix L | eta = 1) and uniform prior on cholesky_factor_corr[n] L;

Hi folks, I have a quick question regarding the LKJ prior.

When using \eta = 1 is:

parameters {
    cholesky_factor_corr[n] L;
}

model {
    target+= lkj_corr_lpdf(L | eta = 1);
}

Equivalent to no prior on L:

parameters {
    cholesky_factor_corr[n] L;
}

I understand that the choice \eta = 1 for the LKJ prior ensures that the correlation matrix is uniform across positive definite matrices with 1 on the diagonal, but does restricting the parameter L to be the Cholesky factor of correlation matrix in the parameter block essentially also do this?

That’s a good question. I don’t think so, at least not for n >= 3. If you don’t put a prior, then a cholesky_factor_corr is uniform over the free elements of L, which I don’t think is the same as being uniform over the correlation matrix Ω = LLᵀ. Specifying lkj_corr_cholesky(1) adds the jacobian term that makes it uniform over the correlation matrices.

This should be target += lkj_corr_cholesky_lpdf(L | 1). It was missing the _cholesky_ and Stan doesn’t allow named arguments like eta = 1.

Thanks for the reply!

I just did the following test:

data {
    int<lower=1> n;
}

parameters {
    cholesky_factor_corr[n] L1;
    cholesky_factor_corr[n] L2;
}

model {
    L1 ~ lkj_corr_cholesky(1);
}

generated quantities {
    corr_matrix[n] R_LKJ = multiply_lower_tri_self_transpose(L1);
    corr_matrix[n] R_unif_L = multiply_lower_tri_self_transpose(L2);
}

And you do indeed get different results (see plot below). In fact choosing a uniform prior over the elements of L (for n>2) means that some correlations end up with wider distributions than others. That isn’t a prior choice that most people would consciously make I imagine.

Also just tested comparing with corr_matrix[n] R_unif_corr; and an LKJ prior appears to be equivalent to this, which makes sense:

Cool, thanks. Interesting to see it visually.

Yes.. Update: NO, for reasons explained in the rest of the thread. I think this is the umpteenth (and hopefully last) time I’ve made this mistake. Here’s what’s really going on

parameters {
  cholesky_factor_corr[N] L_Omega;  // L_Omega uniform on Cholesky factors
  ...
model {
  L_Omega ~ lkj_corr_cholesky(1);  // now L_Omega * L_Omega' uniform on correlation matrices

I removed the confusing discussion of the non-Cholesky case.

See: Correlation Matrix Distributions

@Bob_Carpenter I think for corr_matrix what you said is right, but the Cholesky case is different exactly because of what you say in your last sentence. If I have cholesky_factor_corr[N] L_Omega then I get a flat prior on L_Omega, since the Jacobian is for the free (below-diagonal) elements. But uniform over L isn’t uniform over Ω = LLᵀ. I think you still need to call lkj_corr_cholesky(1) to get the Jacobian adjustment, which is something like \sum_{i=2}^N (N - i) \log L_{ii}. If you don’t specify the prior, then ρ₁₂ = L₂₁ would be Uniform(−1, 1), so the variance is 1/3. With LKJ(1) and e.g. a 3x3 correlation matrix, the off-diagonal correlations are each Beta(1.5, 1.5) on (−1, 1), so the variance is 1/4.

In other words, the original post asked if they needed to call lkj_corr_cholesky(1), and I think they do if they want uniform over correlation matrices, otherwise they don’t get the “Jacobian adjustment for the self transposed product” that you mention in the last sentence.

Please let me know if you think I’m making a mistake somewhere.

This also seems like something @spinkney or @bgoodri would know.

The weird thing about the Cholesky case is that it is uniform over the space of Cholesky factors of correlation matrices but this is not the same as uniform over correlation matrices! @bgoodri wrote about this at Lkj(1) vs no prior on correlation matrix? - #2 by bgoodri.

TL;DR if you want uniformity on correlation matrices then you must put an lkj_corr_cholesky. Not putting that gives uniform on the Cholesky factor of correlation matrices which nobody knows what that is or means.

Thanks for confirming @spinkney!

Thanks for correcting me on this @Jonah. I keep getting this wrong! I corrected my original comment.

I find it confusing, so I end up having to relearn it every so often.