Dear all,

if I have a two-level hierarchical model of *n* subjects with a random intercept of *g* groups, is it possible to calculate the log density (lpdf) of the second level? I know that the syntax for both levels would be like this:

log_lik1[n] = multi_normal_lpdf(x[n,] | mu[n,], L_Sigma);

log_lik2[g] = multi_normal_lpdf(alpha[g,] | alpha_mu[g,], L_Sigma2);

The difference is that x is my observed data, whereas alpha is just a random intercept (non observable). Is this aprpoach still valid and am I able to use log_lik2 for the loo estimation? I want to compare two models, one without a group level predictor and one with a group level predictor.

Thank you very much,

Best

Oliver