PBPStats API Code Examples

In addition to documentation I believe that real code examples are important for making APIs more accessible easier to use. That’s why I created a repository of Jupyter notebooks with Python code examples for every endpoint of the PBPStats API.

Leverage Stats on pbpstats.com

TLDR: Leverage stats on pbpstats.com group stats based on how each much possession impacts win probability. Typically when looking at clutch stats in NBA analysis we just do filters based on score margin and time remaining. There is a sizeable difference in win probability between being down 5 with 4 minutes left and down 1 with 4 minutes left. Your percentage chance of winning a game when down 5 with 45 seconds left are in the single digits so lumping this possession with a possession in a tie game with 45 seconds left doesn’t make much sense to me. [Read More]

SQL Queries for PBPStats Database

I’ve created a Docker image with a PostgreSQL database with 2018-19 NBA data I use for pbpstats.com. It is queryable in a web browser using pgadmin. The instructions for getting started are in the github repo. I’m sharing some queries to show what types of things are possible. The main table is the possession_details table, which has a row with data for each possession. Here is the schema, it should mostly be self-explanatory: [Read More]

My Favourite Features on pbpstats.com

I didn’t really have a plan when I started building pbpstats.com other than to make it easier to find stats that either weren’t available anywhere or weren’t easy to find on other sites. The site has been up for almost two years and here are the features I am most proud of. Wowy Combinations [On/Off –» Wowy Combinations]. I think this is the only place where you can get net ratings for all on/off permutations for a group of players. [Read More]

Why Possession Counts Are Lower on PBPStats Than NBA Stats

This season the NBA stats website started using exact possession counts instead of the estimate they had previously used. While exact counts had previously been available on some smaller sites, including my site, PBPStats , it was good to see what I would assume is the most visited site for NBA stats finally use exact counts. If you have compared numbers on the NBA site and on PBPStats you have probably noticed that the possession counts are different. [Read More]

Lessons From Creating and Maintaining a Basketball Stats Website

When I started building pbpstats.com I didn’t really have a plan for it. My main goal was just to use it as a way to learn something new while building a site that would make it easy to look up stats that weren’t easily accessible. There was a chance it would never be more than a local web app that was only used by me. As I started adding more and more to the site, I realized that I should probably get a domain name and deploy it so others could use it. [Read More]

Play-by-Play Based Shot Quality Model

Not all shots are equal. While you get 2 points for both a breakaway dunk and a tightly guarded, off-balance 20 foot jumper, the dunk is the more valuable shot because it is going to be made nearly every time. Multiple people have created shot quality models to estimate the probability a shot is made based on various factors. You can read about some of them here and here . The better public models all used the no longer public SportVU shot logs. [Read More]