Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football...
Transcript of Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football...
![Page 1: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/1.jpg)
Exploring NFL data with nflscrapR
Ron Yurko (@Stat_Ron)
Department of Statistics & Data Science
Carnegie Mellon University
1
![Page 2: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/2.jpg)
Suppose it’s 4th down with 4 yards to go from the 40 yard line…
You have three options:
1. Punt - sacrifice possession, but gain (some) field position
2. Attempt a field goal - sacrifice possession but (possibly) gain three points
3. GO FOR IT - try to advance the ball four yards and maintain possession
… what do you do???
2
![Page 3: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/3.jpg)
• Expected Points - historically how many points have teams scored in similar situations?
• Win Probability - have teams in similar situations won the game?
• Expected points added (EPA) & Win probability added (WPA)
How do we value a play?
3
![Page 4: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/4.jpg)
• Operations Research on Football (Carter and Machol, 1971)
• The Hidden Game of Football (Carroll, et al 1988)
• Aaron Schatz, Football Outsiders
• Brian Burke, Advanced Football Analytics
• numberFire, Pro Football Focus, ESPN, etc.
Brief history of football analytics
4
![Page 5: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/5.jpg)
NOT ALL YARDS ARE CREATED EQUAL!
5
![Page 6: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/6.jpg)
Recent work in football analytics is not easily reproducible:
• Reliance on proprietary & costly data sources
• Data quality potentially biased by human judgement
Prevents the growth of a football analytics community!
Where’s the data???
6
![Page 7: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/7.jpg)
• There is publicly available play-by-play data!
• NFL API structures its data using JSON for games going back to 2009
• In python, can use `nflgame’ and `nfldb’ by the unsung hero ‘burntsushi` (no longer maintained…)
• nflscrapR retrieves and organizes the API data into easy-to-use data frames, with more!
Enter nflscrapR
7
![Page 8: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/8.jpg)
Expected Points
8
![Page 9: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/9.jpg)
Win Probability
9
![Page 10: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/10.jpg)
air and YAC EPA/WPA
10
![Page 11: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/11.jpg)
11
![Page 12: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/12.jpg)
12
IT’S WORKING
![Page 13: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/13.jpg)
IT’S WORKING
13
![Page 14: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/14.jpg)
Let’s look at some data(ggplot2 football field code courtesy of Michael Lopez
https://github.com/statsbylopez/BlogPosts/blob/master/fball_field.R)
14
![Page 15: Exploring NFL data with nflscrapRryurko/files/useR_nflscrapR.pdf · Brief history of football analytics 4. NOT ALL YARDS ARE CREATED EQUAL! 5. Recent work in football analytics is](https://reader035.fdocuments.in/reader035/viewer/2022070920/5fb9179d197a9643c43c4eea/html5/thumbnails/15.jpg)
Oct 19th: Football Analytics Workshop Featuring a Q&A session with
Michael Lopez, NFL Director of Data & Analytics Oct 20th: Carnegie Mellon Sports Analytics Conference
https://cmusportsanalytics.com/conference2018.html #CMSAC18
Thanks - join us on October 19-20th!
15