nflverse / nflverse/nflverse-data

something odd with WPA

Open
#74 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
396
Forks
45
PR merge metrics
No merged PRs in 30d

Description

I compared the diff of two plays' home_wp_post and WPA in the database.
Is WPA suppose to be the diff of two plays' home_wp_post?
Most numbers check out, but some numbers dont make sense.

Why timeOUT has a different home_wp_post?

Here is what i do:

tic()
test<-pbp %>%
         filter(game_id == "2009_18_GB_ARI",!is.na(home_wp_post)) %>%
         select(game_id,play_id, qtr, desc, total, spread_line, home_wp_post, wpa) %>%
         collect()
toc()

tic()
test <- test %>%
     mutate(wp_diff1 = abs(wpa))
toc()

tic()
test[1,'wp_diff2'] = 0

rownum <- nrow(test)

for (i in 2:rownum){
test[i,'wp_diff2']=abs(test[i,'home_wp_post']-test[i-1,'home_wp_post'])
}
toc()

temp<-test%>%filter(wp_diff2!=wp_diff1)

WPA1
WPA2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied R query and comparison against the database fields home_wp_post and wpa for game 2009_18_GB_ARI. Review how WPA and home_wp_post are defined, especially for timeouts, then document whether the values should differ and identify the cause of any remaining mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.