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),... )
- When number of observations per group is small, consider instead multlevel regression which is a method of partially pooling the varying coefficients. See for example Bayes Rules or Baysian Data Analysis. There is also supposed to be second volume to follow this one, called Applied Regression and Multilevel Models, but seems to be stalled.