add_preseason: Initialize Pre Season Projections into modeling format

Description Usage Arguments Value Examples

View source: R/add_preseason.R

Description

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.

Usage

1
2
add_preseason(run_plays, pass_plays, drives, preseason_vals,
  seed = round(runif(1) * 1e+07))

Arguments

run_plays

the cleaned run plays after the add_epa function

pass_plays

the cleaned pass plays after the add_epa function

drives

the fixed drives after the fix_drives function

preseason_vals

the output from one of the generate_preseason_ functions

seed

the random seed to use. Default is a random seed

Value

A list containing the initial run, pass, and drive values.

Examples

 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 = .)

mattmills49/MELLS documentation built on May 21, 2019, 1:25 p.m.