Hierarchical Model with Multiple Predictors

Thanks for your detailed response. Much appreciated!

However, besides categorical variables, I’m mostly interested in non-categorical ones.
The categorical one is also covered in the primer (county_idx)

~theta = a + b_1[county_idx] * var_1 + b_2[county_idx] * var_2 + ...

The question is how I can extend the regression with any number of variables (b_1,b_2 resp var_1 ,var_2) to (b_1,b_2,b_3,b_4…) without needing to define them each manually and also keep the nice labeling for further work.

~theta = a + b_array[county_idx] * var_array

1 Like