weekly_values_mlm: Generates weekly team-unit estimates

Description Usage Arguments Value Examples

View source: R/weekly_values_mlm.R

Description

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.

Usage

1
weekly_values_mlm(model_runs, model_pass, model_drives)

Arguments

model_runs

the cleaned run plays after the add_epa function

model_pass

the cleaned pass plays after the add_epa function

model_drive

the fixed drives after the fix_drives function

Value

A data frame containing the weekly teem estimates

Examples

 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"]])

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