Get various probabilities associated with each option on PATs (go for it, kick PAT).
add_2pt_probs(df)
Original data frame Data frame plus the following columns added:
Win probability when scoring 0 points on PAT.
Win probability when scoring 1 point on PAT.
Win probability when scoring 2 points on PAT.
Probability of making PAT kick.
Probability of converting 2-pt attempt.
Win probability associated with going for 1.
Win probability associated with going for 2.
# \donttest{
play <-
tibble::tibble(
# things to help find the right game (use "reg" or "post")
home_team = "GB",
away_team = "TB",
posteam = "GB",
type = "post",
season = 2020,
# information about the situation
qtr = 4,
quarter_seconds_remaining = 123,
score_differential = -2,
home_opening_kickoff = 0,
posteam_timeouts_remaining = 3,
defteam_timeouts_remaining = 3
)
probs <- nfl4th::add_2pt_probs(play)
#> Computing probabilities for 1 plays. . .
dplyr::glimpse(probs)
#> Rows: 1
#> Columns: 18
#> $ home_team <chr> "GB"
#> $ away_team <chr> "TB"
#> $ posteam <chr> "GB"
#> $ type <chr> "post"
#> $ season <dbl> 2020
#> $ qtr <dbl> 4
#> $ quarter_seconds_remaining <dbl> 123
#> $ score_differential <dbl> -2
#> $ home_opening_kickoff <dbl> 0
#> $ posteam_timeouts_remaining <dbl> 3
#> $ defteam_timeouts_remaining <dbl> 3
#> $ wp_0 <dbl> 0.2119228
#> $ wp_1 <dbl> 0.2721162
#> $ wp_2 <dbl> 0.4371383
#> $ conv_1pt <dbl> 0.9407482
#> $ conv_2pt <dbl> 0.588913
#> $ wp_go1 <dbl> 0.2685497
#> $ wp_go2 <dbl> 0.3445551
# }