Adds Expected Points calculations to Play-by-Play data.frame
Arguments
- 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- 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- clean_pbp_dat
(data.frame required): Clean PBP as input from
cfbd_pbp_data()
- df
(data.frame required): Clean Play-By-Play data.frame as can be pulled from
clean_pbp_dat()
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_before
calcspred_df
withep_after
calcspred_df_after
on 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.