Description Usage Arguments Value Examples
View source: R/weekly_values_mlm.R
This function takes in the formatted play by play data and build weekly team estimates to be used in the point prediction models. This function uses multilevel models on play by play data prior to a given week to build the estimates going in to that week.
1 | weekly_values_mlm(model_runs, model_pass, model_drives)
|
model_runs |
the cleaned run plays after the |
model_pass |
the cleaned pass plays after the |
model_drive |
the fixed drives after the |
A data frame containing the weekly teem estimates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | years <- 2013:2014
plays <- readin("play", years)
teams <- readin("team", years)
runs <- readin("rush", years)
pass <- readin("pass", years)
games <- readin("game", years)
conf <- readin("conference", years)
epa_model <- expected_points_build(plays[plays$Year != 2014, ], drives[drives$Year != 2014, ])
fixed_games <- fix_games(games)
drives <- fix_drives(fixed_games, drives)
model_plays <- combine_run_pass(runs, pass, fixed_games) %>% remove_garbage %>% fix_fcs(teams, conf) %>% add_epa(epa_model)
model_values <- generate_preseason_mlm(run_plays = model_plays[["run_info"]], pass_plays = model_plays[["pass_info"]]) %>% add_preseason(run_plays = model_plays[["run_info"]], pass_plays = model_plays[["pass_info"]], drives = drives, preseason_vals = .)
weekly_values <- weekly_values_mlm(model_runs = model_values[["run_data"]], model_pass = model_values[["pass_data"]], model_drives = model_values[["drives_data"]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.