Free & Open Source

The Ultimate Guide to NBA Analytics

Master basketball analytics with R and Python. From traditional box scores to cutting-edge player tracking data, learn the exact skills used by NBA front offices, scouts, and professional analysts.

52

Chapters

260

Sections

850

Code Examples

52

Exercises
analysis.R
library(hoopR)
library(tidyverse)

# Get 2024 player tracking data
player_stats <- nba_leaguedashplayerstats(
  season = "2023-24",
  measure_type = "Advanced"
)

# Find most efficient volume scorers
elite_scorers <- player_stats %>%
  filter(MIN > 25, FGA > 10) %>%
  mutate(
    true_shooting = PTS / (2 * (FGA + 0.44 * FTA)),
    points_added = (true_shooting - 0.572) * TSA
  ) %>%
  arrange(desc(points_added)) %>%
  head(20)

Built with data from industry leaders

NBA Stats Basketball Reference Cleaning the Glass Second Spectrum Synergy Sports

Why Choose This Textbook

Everything You Need to Master Basketball Analytics

Dual Language Coverage

Every concept explained with complete code examples in both R and Python. Switch between languages with a single click.

  • Side-by-side R & Python code
  • Identical outputs & analysis
  • Best practices for each language
Tracking Data Analytics

Go beyond box scores with modern tracking data. Learn to analyze player movement, shot quality, and defensive impact.

  • Player movement analysis
  • Shot quality models (qSQ)
  • Defensive tracking metrics
Career-Ready Skills

Learn the exact analytical techniques used by NBA front offices. Build portfolio projects that demonstrate your abilities.

  • Industry-standard methods
  • Portfolio project ideas
  • Career guidance chapter
Machine Learning

Apply modern ML techniques to basketball problems. Build player projections, clustering models, and win probability systems.

Interactive Visualizations

Create stunning shot charts, court plots, and dashboards with ggplot2, matplotlib, Shiny, and Streamlit.

Historical Analysis

Compare players across eras with proper pace and era adjustments. Analyze all-time rankings and Hall of Fame probability.

Your Learning Journey

Progress from fundamentals to advanced techniques in a logical sequence

1
Foundations

Learn R/Python basics, data wrangling with tidyverse/pandas, and how to access NBA data sources.

Chapters 1-4
2
Core Analytics

Master traditional stats (PER, TS%), plus-minus metrics (BPM, RPM, RAPTOR), and modern tracking data.

Chapters 5-10
3
Advanced Methods

Build predictive models, create custom metrics, and explore machine learning applications in basketball.

Chapters 11-16
4
Applied Topics

Specialize in draft analytics, salary cap, player development, fantasy sports, betting models, and more.

Chapters 17+

All Chapters

From fundamentals to cutting-edge techniques - everything you need in one place

R or Python? Why Not Both?

Every example is available in both languages. Learn one or master both.

R
The Statistical Computing Language

R has deep roots in sports analytics with powerful statistical packages and visualization tools.

  • hoopR - Play-by-play and player data
  • nbastatR - Comprehensive NBA data access
  • tidyverse - Modern data manipulation
  • ggplot2 - Publication-quality visualizations
  • Shiny - Interactive web applications

Best for: Statistical analysis, visualization, academic research

Python
The Versatile Programming Language

Python dominates modern NBA analytics departments with its ML ecosystem and production capabilities.

  • nba_api - Official NBA stats API wrapper
  • pandas - Industry-standard data manipulation
  • basketball_reference_scraper - Historical data
  • matplotlib & seaborn - Visualizations
  • scikit-learn - Machine learning

Best for: Machine learning, automation, production systems

Perfect for Every Basketball Enthusiast

Whether you're pursuing a career in basketball or just want to understand the game better

Aspiring Front Office Analysts

Learn the exact skills NBA teams look for. Build a portfolio of projects demonstrating player evaluation and projection systems.

Fantasy Basketball Players

Gain a competitive edge with data-driven player evaluation. Identify breakout candidates and optimize your draft strategy.

Students & Researchers

Perfect for sports analytics courses, independent study, or research projects. Combines statistical theory with practical application.

Journalists & Content Creators

Tell compelling data-driven stories. Learn to find insights, create visualizations, and communicate analytics to general audiences.

Coaches & Player Development

Integrate modern analytics into player development and evaluation. Understand what the numbers mean and how to apply them.

Passionate Fans

Deepen your understanding and enjoyment of the game. See basketball through the lens of data and appreciate every decision.

Ready to Start Your Analytics Journey?

Join thousands of basketball fans learning to analyze the game they love.
No registration required - start learning immediately.

100% free, no account required, no ads