Logo
HomeAboutBlogWorkshops
Contact us
Footer Icon

The Probabilistic AI
Consultancy

Home
About
Blog

Subscribe to our newsletter

Stay connected with the latest developments in Probabilistic AI Statistics and AI.

You can unsubscribe at any time. For more details, review ourPrivacy Policypage.

Contact

© 2025 PyMC Labs. All Rights Reserved.

NBA Foul Analysis with Item Response Theory using PyMC

Blog

July 15, 2022

By Austin Rochford

This tutorial shows an application of Bayesian Item Response Theory to NBA basketball foul calls data using PyMC. It is based on Austin Rochford’s blogpost NBA Foul Calls and Bayesian Item Response Theory.

Motivation

Our scenario is that we observe a binary outcome (a foul being called or not) from an interaction (a basketball play) of two agents with two different roles (the player committing the alleged foul and the player disadvantaged in the play). Moreover, each committing or disadvantaged agent is an individual which might be observed several times (say LeBron James observed committing a foul in more than one play). Then it might be that not only the agent’s role, but also the abilities of the single individual player contribute to the observed outcome. And so we’d like to estimate the contribution to the observed outcome of each individual’s (latent) ability as a committing or disadvantaged agent. This would allow us, for example, to rank players from more to less effective, quantify uncertainty in this ranking and discover extra hierarchical structures involved in foul calls. All pretty useful stuff!

So how can we study this common and complex multi-agent interaction scenario, with hierarchical structures between more than a thousand individuals?

Despite the scenario’s overwhelming complexity, Bayesian Item Response Theory combined with modern powerful statistical software allows for quite elegant and effective modeling options. One of these options employs a Generalized Linear Model called Rasch model, which we now discuss in more detail.

For the full example, see:
NBA Foul Analysis with Item Response Theory