Recover correlation between random effects from posterior samples

Dear all,

question: in a linear mixed effects model (LME, also known as hierarchical model), can the correlation coefficient between the random effects be recovered from the posterior samples?

Thanks to your previous help (here), I managed to fit a LME for the sleep study, with random intercept and slope for each subject ( Reaction ~ Days + (Days | Subject). In the STAN code (generated with the help of brms) the correlation between the random effects was explicitly modeled via the Cholesky decomposition, and the model fit gives a correlation coefficient between intercepts and slopes of about 0.09 [-0.48, 0.68].

Next, I tried to recover the correlation coefficient from the posterior samples. I was expecting to be able to recover the correlation coefficients accurately. However, the estimation I got is not correct and slightly (?) off (i.e., 0.10 [-0.28, 0.62]). They way I did was to compute the correlation between the intercepts and slopes across participants for each step in the MCMC trace.

Any ideas?

Thank you

Your way would match the print output if you had many, many draws from the posterior distribution, but it is a noisy measure of the correlation with only 18 subjects or whatever.

I understand, so in theory (let’s say with infinite samples) I can recover the correlation from the posterior samples. Thank you!