create_epa | R Documentation |
Adds Expected Points calculations to Play-by-Play data.frame
create_epa(play_df, ep_model, fg_model) epa_fg_probs(dat, current_probs, ep_model, fg_mod)
ep_model |
(model, default |
fg_model |
(model default |
current_probs |
(data.frame required): Expected Points (EP) model raw probability outputs from initial prediction |
fg_mod |
(model, default |
clean_pbp_dat |
(data.frame required): Clean PBP as input from |
df |
(data.frame required): Clean Play-By-Play data.frame as can be pulled from |
Code Description
pred_df
:Use select before play model variables -> Make predictions.
epa_fg_probs
:Update expected points predictions from before variables with FG make/miss probability weighted adjustment.
pred_df_after
:Use select after play model variables -> Make predictions.
join_ep
:Join ep_before
calcs pred_df
with ep_after
calcs pred_df_after
on c("game_id","drive_id","new_id").
kickoffs
:Calculate ep_before for kickoffs as if the pre-play assumption is a touchback.
wpa_prep
:Prep variables for WPA.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.