Given a dataset of plays and the necessary variables, this function returns the original dataset with columns appended from the expected points model. The user is also allowed to input values of the different scoring events, for instance if they believe a TD is more likely to be worth 6 or 8 points.
calculate_expected_points(pbp_data, half_seconds_remaining, yard_line_100, down,
yards_to_go, goal_to_go, td_value = 7, fg_value = 3, safety_value = 2)
Play-by-play dataset to estimate expected points for.
String denoting the name of the column of the pbp_data containing the number of seconds remaining in the current half.
String denoting the name of the column of the pbp_data containing the yards away from the opponents' endzone.
String denoting the name of the column of the pbp_data containing the down of the play.
String denoting the name of the column of the pbp_data containing the yards to go for a first down of the play.
String denoting the name of the column of the pbp_data containing the indicator for whether or not the play is in a goal down situation.
Numeric point value for a TD occurring, default is 7.
Numeric point value for a FG occurring, default is 3.
Numeric point value for a safety occurring, default is 2.
The original pbp_data with the following columns appended to it: ep (expected points), no_score_prob (probability of no score occurring until the end of the half), opp_fg_prob (probability of opposing team scoring a field goal next), opp_safety_prob (probability of opposing team scoring a safety next), opp_td_prob (probability of opposing team scoring a TD next), fg_prob (probability of possession team scoring a field goal next), safety_prob (probability of possession team scoring a safety next), and td_prob (probability of possession team scoring a touchdown next).