I think in this case you might initially think to to give the pointwise log likelihood as
normal_lpdf(y_true[i] | alpha0 + alpha[group[i]] + beta * x[i,], sigma) +
normal_lpdf(y_obs[i] | y_true[i], y_err);
But that won’t work well with loo
because it depends on the observation-specific parameter y_true
. Fortunately we can get rid of the y_true
here with
normal_lpdf(y_true[i] | alpha0 + alpha[group[i]] + beta * x[i,], sqrt(sigma^2, y_err^2));
I’m pretty sure that’s the pointwise log-likelihood that you want, but maybe @martinmodrak might be kind enough to double-check with his perspective. I don’t think that the post-sweeping matters at all to the likelihood.