I'm considering a model where children are nested within schools, but may change schools over time. So, I have data structured as CHILDID, Y1, X1, SCHOOLID1, Y2, X2, SCHOOLID2, ...
I initially considered having a single random effect value per school, and having $y_{i,t,school} = \mu_{school} + \dots$, but I'm not sure how to index the same random effect by different variables over time (i.e. mu[SCHOOL1]
, mu[SCHOOL2]
) in this way.
I then considered having a random effect per school per time, which seemed like a better idea, but it seems unclear to me how to account for dependency of the random effect within schools over time (similar issue to above, to correlate the random effects would require indexing by different values within the same model).
Anyone have any idea how I can estimate something like this?