Description Usage Arguments Value Examples
View source: R/add_preseason.R
Takes the preseason projections for teams based on the generate_preseason
function and puts them in the proper format to use to build the team
model estimates. It does this by "building" a game's worth of plays for
each team from their preseason forecasts. See the vignette for more info.
1 2 | add_preseason(run_plays, pass_plays, drives, preseason_vals,
seed = round(runif(1) * 1e+07))
|
run_plays |
the cleaned run plays after the |
pass_plays |
the cleaned pass plays after the |
drives |
the fixed drives after the |
preseason_vals |
the output from one of the |
seed |
the random seed to use. Default is a random seed |
A list containing the initial run, pass, and drive values.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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 = .)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.