22.5 Multilevel or hierachical models

  • Can often make sense to allow regression coefficients to vary by group, which can be included by simply incuding the group as a factor in the model:
stan_glm(y ~ x + factor(state) + x:factor(state),... )