Advanced Basketball Data Science

R code, data and functions

Supplementary materials for reproducing the case studies presented throughout the book.

R code, data and functions

The zip file contains datasets (Table 1.11), R scripts (Table 1.12), additional functions (Tables 1.13-1.14). An overall overview of  supplementary materials is in Table 1.15. See sections 1.2 and 1.3 for details.

Functions in the file additional_functions.R 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

Official preview of the book

Official Routledge page


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

Book presentation tour schedule

Athens, Greece (5 May, 2026 4:30 p.m. – Athens University of Economics and Business)
Event scheduled at the AUEB Sport Analytics Workshop, organised by Ioannis Ntzoufras and Dimitris Karlis

Madrid, Spain (8 September, 2026 5:00 p.m. – Salón de Actos, Quintana Aulario – Laboratorio de Ciencia de Datos)
organised by Isaac Martín de Diego and Emilio López Cano (Rey Juan Carlos University)

Barcelona, Spain (9 September, 2026 5:00 p.m. – Sala Assumpció, Gran Via de les Corts Catalanes, 585 – Universitat de Barcelona & Federació Catalana de Basquetbol)
Organised by Daniel Fernández Martínez, Jordi Cortés and Martí Casals (Universitat Politècnica de Catalunya)

Valencia, Spain (24 September, 2026 1:00 p.m. – Universitat de València)
Organised by Gabriel Calvo Bayarri  (Universitat de València)