Learn R Programming

nflscrapR (version 1.8.3)

win_probability: Win probability function to add win probability columns for the home and away teams for each play in the game

Description

This function takes in the output of the game level play by play function and returns the same dataframe with six new columns representing the win probability for the home and away team pre and post snap and win probability added. The model used to calculate win probability is a generalized additive model using the expected score differential, time remaining in game, also accounting for the timeouts remaining for both teams. Overtime win probability is calculated separately using the scoring event probabilities.

Usage

win_probability(dataset)

Arguments

dataset

(data.frame object) A data.frame as exported from the game_play_by_play function

Value

The input dataframe with the addition of six win probability columns giving the win probability for the possession team, the WPA for each play, the pre and post win probability for both the home and away teams.