Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPA wrong for sequence: TD, TO, Penalty, XP try #365

Open
bkmontgom opened this issue Sep 11, 2022 · 1 comment
Open

EPA wrong for sequence: TD, TO, Penalty, XP try #365

bkmontgom opened this issue Sep 11, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@bkmontgom
Copy link

Examples:
2008_10_SF_ARI play_id's 4080, 4094, 4114
2021_13_LAC_CIN play_id's 1518, 1573, 1538

On the timeout "play" the ep is calculated as if it's a regular play near the goalline. (This is the worst part.)
Then there is no epa cost for the penalty.

nflfastR ver 4.4

@bkmontgom bkmontgom added the bug Something isn't working label Sep 11, 2022
@mrcaseb
Copy link
Member

mrcaseb commented Sep 27, 2022

Good catch!
This seems to be a rare case where nflfastR can't recognize a PAT (either 2pt or XP). Since it doesn't know it's PAT, EP is quite high on these PATs. I think the other EP values are affected by this.

pbp <- nflfastR::build_nflfastR_pbp(c("2021_13_LAC_CIN", "2008_10_SF_ARI"))
pbp |> 
  dplyr::filter(
    (game_id == "2008_10_SF_ARI" & dplyr::between(play_id, 4080, 4114)) |
    (game_id == "2021_13_LAC_CIN" & dplyr::between(play_id, 1518, 1573))
  ) |> 
  dplyr::select(game_id, play_id, desc, ep, epa, down, extra_point_attempt, two_point_attempt)
#> ── nflverse play by play ───────────────────────────────────────────────────────
#> ℹ Data updated: 2022-09-27 11:08:52 CEST
#> # A tibble: 7 × 8
#>   game_id         play_id desc                   ep    epa  down extra…¹ two_p…²
#>   <chr>             <dbl> <chr>               <dbl>  <dbl> <dbl>   <dbl>   <dbl>
#> 1 2008_10_SF_ARI     4080 Timeout #2 by SF a… 5.59   0        NA       0       0
#> 2 2008_10_SF_ARI     4094 PENALTY on ARI-69-… 5.59  -4.64     NA       0       0
#> 3 2008_10_SF_ARI     4114 TWO-POINT CONVERSI… 0.947 -0.947    NA       0       1
#> 4 2021_13_LAC_CIN    1518 Timeout #1 by CIN … 5.70   0        NA       0       0
#> 5 2021_13_LAC_CIN    1573 (Run formation) PE… 5.70  -4.82     NA       0       0
#> 6 2021_13_LAC_CIN    1538 2-E.McPherson extr… 0.878 -0.878    NA       1       0
#> 7 2021_13_LAC_CIN    1554 2-E.McPherson kick… 1.33  -0.317    NA       0       0
#> # … with abbreviated variable names ¹​extra_point_attempt, ²​two_point_attempt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants