Created
September 25, 2018 05:23
-
-
Save friscojosh/e20f063f9c6e90d985cd88469b3889af to your computer and use it in GitHub Desktop.
Completion Probability Stability Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
data <- read_csv("data/xcomp.csv") | |
data_joined <- data %>% | |
mutate(season2 = Season + 1) %>% | |
inner_join(data, by = c("NAME", "season2" = "Season")) | |
model_expected <- lm(data = data_joined, `xCOMP%.y` ~ `xCOMP%.x`) | |
summary(model_expected) | |
model_plus_minus <- lm(data = data_joined, `+/-.y` ~ `+/-.x`) | |
summary(model_plus_minus) | |
comp_oe <- read_csv("data/__qb_yards_expected.csv") | |
two_year_comp_airyards <- comp_oe %>% | |
filter(season_year %in% c(2016:2017)) %>% | |
mutate(season2 = season_year + 1) %>% | |
filter(att >= 128) %>% | |
mutate(plus_minus = (comp / att) - expected_completion_pct) | |
two_year_comp_airyards_joined <- two_year_comp_airyards %>% | |
inner_join(two_year_comp_airyards, by = c("player_id", "season2" = "season_year")) | |
model_airyards_expected <- lm(data = two_year_comp_airyards_joined, expected_completion_pct.y ~ expected_completion_pct.x) | |
summary(model_airyards_expected) | |
model_airyards_plus_minus <- lm(data = two_year_comp_airyards_joined, plus_minus.y ~ plus_minus.x) | |
summary(model_airyards_plus_minus) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment