Nesting with movement between clusters over time

Posted on
No user picture. jpritsker Joined: 09/27/2020
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?

Replied on Thu, 10/08/2020 - 20:46
Picture of user. jpritikin Joined: 05/23/2012

It depends on the size of your dataset. If you have very small data then you can create any arbitrary model structure. However, it will get too slow for larger data. Consider [Stan](https://mc-stan.org/) for such complex models.