Simulation-based linear mixed effect regression models with stan

Jake Jing
5 min readDec 26, 2021

In this blog, I will provide a step-by-step instruction of how we can generate data from a mixed effect model and recover the parameters of the model with the simulated dataset. This simulation-based experiment can help us better understand the structure and generative process of the multilevel model with correlated random intercepts and slopes. To proceed, I will first illustrate the general form of mixed effect models, and generate data based on a given set of design matrices and parameters (X, ß, Z, b). In the end, I will build a Bayesian…

--

--