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)
(model, default cfbfastR
's ep_model
): FG Model to be used for prediction on field goal (FG) attempts in Play-by-Play data.frame
(model default cfbfastR
's fg_model
): Field Goal (FG) Model
(data.frame required): Expected Points (EP) model raw probability outputs from initial prediction
(model, default cfbfastR
's fg_model
): FG Model to be used for prediction on field goal (FG) attempts in Play-by-Play data.frame
(data.frame required): Clean PBP as input from cfbd_pbp_data()
(data.frame required): Clean Play-By-Play data.frame as can be pulled from clean_pbp_dat()
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.