R + Tidyverse in Sports
summary
Case study builds an expected goals model for NHL unblocked shots (2017–present) using R and the Tidyverse, ingesting MoneyPuck CSVs scraped by Peter Tanner and cleaning with janitor and purrr. A distance-only logistic regression hits most of the signal (unblocked shots ≈ 6% goal rate; that example shot ≈ 10%), while an xgboost model with angle, shot type and time-since-last-event nudges estimates to ~12% and improves log loss/AUC versus the simple model; shooter/goalie effects come from residuals after filtering for sample size.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 2:20Statistical Aspects
- 2:47Shots
- 2:57Goal
- 5:22Block Shots
- 6:10Expected Goals
- 6:51Disclaimer
- 7:26Playbyplay data
- 9:07Big code chunk
- 9:57Heat maps
- 10:43Shot distance
- 11:20Boosting
- 12:04Variable Inclusion
- 13:59Variable Importance Metrics
- 15:56Model Comparison
- 19:13Outro
related talks
41mThe evolution of basketball with data science
19mFootball Analytics with the Soccermatics Package
38mDeep Learning plays Handball
45mThe Technical Journey to Define the True Value of a Football Goal
42mHow Deep Learning is Revolutionizing Sports Analytics
32mCutting Edge Football Analytics in Python
04mInteractive Sports Analytics
35mDecoding bias and narrative in competitive video games
