19.1 Introduction

In this chapter, we will extend linear models and generalized linear models to include hierarchical error structures in Bayesian estimation. These are analogous to the linear mixed models introduced in Chapter 14. We will start with examples of the linear mixed model (LMM) in this Chapter and extend these to include non-normal data when we dig into Bayesian hierarchical formulations of the generalized linear model in Chapter 20.

In this chapter, we’ll use the usual tools from the rstanarm package as well as the usual suite of functions we need from the tidyverse. Go ahead and load them up when you are ready to get started:

library(tidyverse)
library(rstanarm)