Multilevel Models
Goal: estimate avg. number of points eventually scored by teams from similar situation
EPA: diff. in post- and pre-play EP
nflfastR’s EP model to predict next scoring event in half
Vector of next score probabilities given play features \(\boldsymbol{\mathbf{z}}\): \(\boldsymbol{\pi}(\boldsymbol{\mathbf{z}}) = (\pi_{\textrm{TD}}(\boldsymbol{\mathbf{z}}), \ldots, \pi_{\textrm{oppFG}}(\boldsymbol{\mathbf{z}}))\)
Estimated w/ regression tree ensemble using XGBoost
Definition: Expected Points
Given a game state feature vector \(\boldsymbol{\mathbf{z}}\) and vector of drive outcome probabilities \(\boldsymbol{\pi}(\boldsymbol{\mathbf{z}}),\) the expected points \(\textrm{EP}(\boldsymbol{\mathbf{z}})\) is \[ \begin{align} \textrm{EP}(\boldsymbol{\mathbf{z}}) &= 7\times\pi_{\textrm{TD}}(\boldsymbol{\mathbf{z}}) + 3\times\pi_{\textrm{FG}}(\boldsymbol{\mathbf{z}}) + 2\times\pi_{\textrm{SAF}}(\boldsymbol{\mathbf{z}}) \\ ~&~~-2\times\pi_{\textrm{oSAF}}(\boldsymbol{\mathbf{z}}) - 3\times\pi_{\textrm{oFG}}(\boldsymbol{\mathbf{z}}) - 7\times\pi_{\textrm{oTD}}(\boldsymbol{\mathbf{z}}) \end{align} \]
mean(pbp2024$epa) reasonable?passer_player_id & compute mean(epa) for each playerepa on categorical passer_player_idpasser_player_id to a factor variableLevel 1: observed EPA for player \(i\) normally distributed around \(\alpha_{i}\)
Level 2: Latent player abilities \(\alpha_{i}\)’s are themselves normally distributed around \(\mu\) \[ \begin{align} \textrm{Level 1}&: &\quad Y_{ij} &= \alpha_{i} + \epsilon_{ij}; \epsilon_{ij} \sim N(0, \sigma^{2}) \quad \textrm{for all}\ j = 1, \ldots, n_{i},\ i = 1, \ldots, I \\ \textrm{Level 2}&: &\quad \alpha_{i} &= \alpha_{0} + u_{i}; u_{i} \sim N(0, \sigma^{2}_{\alpha}) \quad \textrm{for all}\ i = 1, \ldots, I \end{align} \]
\(\alpha_{0}\): average per-pass EPA over super-population of passers
\(\sigma\) captures “within-player” variability in EPA pass-to-pass
\(\sigma_{\alpha}\) captures “between-player” variability in per-pass EPA
(1 | passer_player_id) tells lmer() to include a random intercept for each passerranef() to extract estimates \(\hat{u}_{i}\)’scoef to get \(\hat{\alpha}_{i} = \hat{\alpha}_{0} + \hat{u}_{i}\)
coef() and ranef() return lists w/ one element per grouping variable
air_yards, shotgun, qb_hit, pass_location, posteam_typeEPA is based on starting & ending game state
2 phases of passing play: ball in air + after the catch
Currently analysis implicitly credits QBs for both phases
Lecture 10: divide total EPA among relevant offensive players
Develop a version of WAR