20.1 Introduction

In Chapter 14 we introduced the generalized linear mixed model (GLMM) through the lens of the linear mixed model (LMM) in restricted maximum likelihood estimation. Many of the difficulties in specifying, estimating, and predicting from those models are trivial in Bayesian hierarchical models by comparison.

We will use examples of logistic regression and count models to investigate Bayesian hierarchical GLMs in this chapter and round out our discussions from Chapters 14, 15, and 19. To do this, we will need our usual faves from the tidyverse and rstanarm. You know the drill:

library(tidyverse)
library(rstanarm)