Advanced Basketball Data Science

The book is not published yet. This page is under construction.

Codes, data and functions

Codes, data and functions for reproducing the case studies presented throughout the book.

Codes (pdf format)

Codes (R format)

Data

Functions

Code tested on both Windows and macOS, using R version 4.5.2 and RStudio version 2025.09.2+418, and on Ubuntu Linux 25.10 (64-bit, kernel 6.17) using R version 4.5.1 and RStudio version 2025.09.2+418.


Table of Contents

1 Getting Started: Overview and Supporting Materials

I – Analyzing and comparing game splits
2 Beyond individual skills
3 Drilling down on clutch splits: measuring performance
when it matters most
4 The race to the finish: exploring the relationship between season
segments and final rankings

II – Decoding motion
5 Understanding players’ spatial dynamics
6 Athletic motion kinematics analysis
7 Tracking and analyzing ball trajectories

III – Spatial performance analysis
8 Basketball performance maps based on court segmentation
9 Scoring probability maps via machine learning algorithms


Animated GIFs produced in the book

4.2 Teams’ evolving performance from start to finish
5.1 Animated plots of the players’ movements on the court
5.2 Gravity and Distraction
6.4.1 Animated pose detection
6.5.1 Crossover
6.5.2 Shot
7.1.2 Ball detection in a video