calculate_expected_points: Compute expected points for provided play-by-play dataset

Description Usage Arguments Value

View source: R/ep_wp_calculator.R

Description

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.

Usage

1
2
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)

Arguments

pbp_data

Play-by-play dataset to estimate expected points for.

half_seconds_remaining

String denoting the name of the column of the pbp_data containing the number of seconds remaining in the current half.

yard_line_100

String denoting the name of the column of the pbp_data containing the yards away from the opponents' endzone.

down

String denoting the name of the column of the pbp_data containing the down of the play.

yards_to_go

String denoting the name of the column of the pbp_data containing the yards to go for a first down of the play.

goal_to_go

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.

td_value

Numeric point value for a TD occurring, default is 7.

fg_value

Numeric point value for a FG occurring, default is 3.

safety_value

Numeric point value for a safety occurring, default is 2.

Value

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).


maksimhorowitz/nflscrapR documentation built on April 3, 2020, 7:40 p.m.