Hello Everyone,

About my specific model, i’m kind of struggling right now, and i am wondering if maybe you could help me out. Specifically i want to fit a multilevel hierarchical linear regression model that has nested predictors. It’s actually a time series but we do not treat it as so because some of the predictors quantify seasonality effects. There are 3 important levels in our model, and we call them P, C, and R. There are respectively nR, nC and nP (typically ~ 10) possible discrete values at each specific level and in our setting, P is “over” C, and C is “over” R. In the end, I want to get estimates of the regression coefficients at the P level, at the P x C level, and at the P x C x R level. Here’s the simplified hierarchical structure:

I have trouble understanding 1) how we should specify the code for that in Stan and 2) how the input data should look like. Attached is the Stan code we’ve written so far in which you can see the whole structure and the choice of priors. Ifeel like we’re almost there but also that something is missing to make it work.

test_forum.R (1.9 KB)

Any advice would be amazing.

Thanks a lot ,