Chapter 17 (Normal) Hierarchical Models with Predictors

Learning objectives:

  • Build hierarchical (H) regression models of response variable \(Y\) by predictors \(X\)

  • Evaluate and compare H and non H models

  • Use H models for posterior prediction

17.0.1 Data set

We are returning on a subset of the Cherry Blossom 10 mile running race analysis

# Load packages
library(bayesrules)
library(tidyverse)
library(rstanarm)
library(bayesplot)
library(tidybayes)
library(broom.mixed)
# Load data
data(cherry_blossom_sample)
running <- cherry_blossom_sample

A bit of data wrangling:

running <- running |> 
  select(runner, age, net) |> 
  na.omit()

nrow(running)
## [1] 185
unique(running$runner)
##  [1] 1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
## [26] 26 27 28 29 30 31 32 33 34 35 36
## 36 Levels: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 36

We have 36 runners and 185 rows.