Adds Expected Points calculations to Play-by-Play data.frame
Arguments
- play_df
(data.frame required): Clean PBP as input from
cfbd_pbp_data()- ep_model
(model, default
cfbfastR'sep_model): FG Model to be used for prediction on field goal (FG) attempts in Play-by-Play data.frame- fg_model
(model default
cfbfastR'sfg_model): Field Goal (FG) Model- dat
(data.frame required): Clean Play-By-Play data.frame as can be pulled from
clean_pbp_dat()- current_probs
(data.frame required): Expected Points (EP) model raw probability outputs from initial prediction
- fg_mod
(model, default
cfbfastR'sfg_model): FG Model to be used for prediction on field goal (FG) attempts in Play-by-Play data.frame
Value
play_df with EPA variables added
Updated expected points probabilities with FG make/miss weighted adjustment
Details
Code Description
- 1.
pred_df: Use select before play model variables -> Make predictions.
- 2.
epa_fg_probs: Update expected points predictions from before variables with FG make/miss probability weighted adjustment.
- 3.
pred_df_after: Use select after play model variables -> Make predictions.
- 4.
join_ep: Join
ep_beforecalcspred_dfwithep_aftercalcspred_df_afteron c("game_id","drive_id","new_id").- 5.
kickoffs: Calculate ep_before for kickoffs as if the pre-play assumption is a touchback.
- 6.
wpa_prep: Prep variables for WPA.
