Browsed by
Tag: PyMC

Bayesian Decision Analysis

Bayesian Decision Analysis

At PyData Global 2025 I presented a workshop on Bayesian Decision Analysis with PyMC. The video is available now.

This workshop is based on the first session of the Applied Bayesian Modeling Workshop I teach along with my colleagues at PyMC Labs. If you would like to learn more, it is not too late to sign up for the next offering, starting Monday January 12.

Resources:

Here’s the abstract and description of the workshop.

Bayesian Decision Analysis with PyMC: Beyond A/B Testing

This hands-on tutorial introduces practical Bayesian inference using PyMC, focusing on A/B testing, decision-making under uncertainty, and hierarchical modeling. With real-world examples, you’ll learn how to build and interpret Bayesian models, evaluate competing hypotheses, and implement adaptive strategies like Thompson sampling. Whether you’re working in marketing, healthcare, public policy, UX design, or data science more broadly, these techniques offer powerful tools for experimentation, decision-making, and evidence-based analysis.

Description

Bayesian methods offer a natural and interpretable framework for updating beliefs with data, and PyMC makes it easy to apply these techniques in practice. In this tutorial, we’ll walk through a series of examples that demonstrate the core concepts:

  1. Bayesian A/B Testing with the Beta-Binomial Model
  • Represent prior beliefs with the beta distribution
  • Use binomial likelihoods to model observed outcomes
  • Understand posterior distributions and credible intervals
  1. Bayesian Bandits and Thompson Sampling
  • Go beyond hypothesis testing: estimate the probability of one version outperforming another
  • Use Thompson sampling to guide decision-making
  • Simulate and visualize an adaptive email campaign
  1. Hierarchical Models for Partial Pooling and Prediction
  • Learn how to share information across variants
  • Use posterior predictive distributions to quantify uncertainty
  • Understand second-order probabilities

Hands-On Learning

Participants will follow along in Jupyter notebooks (hosted on Colab — no installation required). Exercises are embedded throughout, with guided solutions. Code is based on PyMC, ArviZ, and standard scientific Python libraries.

Prerequisites

  • Intermediate Python: basic familiarity with NumPy, plotting, and Jupyter notebooks
  • No prior experience with Bayesian statistics or PyMC is assumed
  • All materials run on Colab (no setup required)

SAT math scores: gender difference or selection bias?

SAT math scores: gender difference or selection bias?

The video from my PyData Boston talk is up now:

Resources

If you want to learn to do this kind of analysis, you can sign up for the January 2026 offering of the Applied Bayesian Modeling Workshop, which I teach along with my colleagues at PyMC Labs.

And as always, you can read Think Bayes in hard copy or free online.

Abstract

Why do male test takers consistently score about 30 points higher than female test takers on the mathematics section of the SAT? Does this reflect an actual difference in math ability, or is it an artifact of selection bias—if young men with low math ability are less likely to take the test than young women with the same ability?

This talk presents a Bayesian model that estimates how much of the observed difference can be explained by selection effects. We’ll walk through a complete Bayesian workflow, including prior elicitation with PreliZ, model building in PyMC, and validation with ArviZ, showing how Bayesian methods disentangle latent traits from observed outcomes and separate the signal from the noise.