I am starting to get into multivariate modelling and was playing with the above mentioned functions by exposing them in RStan and found consistent differences in the lpdf’s with the “same” (L_Omega or Omega) inputs. Is this a significant difference?
functions {
real lkj_cor_lpdf(matrix y, real eta) {
return lkj_corr_lpdf(y | eta);
}
matrix lkj_cor_rng(int K, real eta) {
return lkj_corr_rng(K, eta);
}
real lkj_cor_cholesky_lpdf(matrix L, real eta) {
return lkj_corr_cholesky_lpdf(L | eta);
}
matrix lkj_cor_cholesky_rng(int K, real eta) {
return lkj_corr_cholesky_rng(K, eta);
}
real st_cauchy_rng(real mu, real sigma) {
return cauchy_rng(mu, sigma);
}
matrix corr_matrix_cholesky(matrix L_Omega) {
return multiply_lower_tri_self_transpose(L_Omega);
}
}
You should input Omega into lkj_corr_lpdf and input L into lkj_corr_cholesky_lpdf. In other words, lkj_corr_lpdf is the log-density of a correlation matrix under the LKJ distriution and lkj_corr_cholesky_lpdf is the log-density of the Cholesky factor of a correlation that has a LKJ distribution.
That is because the density of a LKJ distribution is constant when \eta = 1, although that is not so in the case of lkj_corr_cholesky_lpdf(L | eta) due to the Jacobian term.
I am now in a rabbit-hole of understanding Jacobians transforms/adjustments. I learned about Jacobians in school but didn’t bother to think it was important in applied stats.