Bayesian model diagnostics: Workflows and software tools
Material
The material for this tutorial consists of the slides, exercises, and this book.
Exercises
The exercises are available in both Python and R:
- Download and expand this zip file
- This contains the exercises in different formats
- For RStudio, first open the file
stancon2026-workflow-tools.Rproj, then openexercises-r.qmd - For Python, use the
exercises-python.ipynbfile - The first chunk will install the required packages. For R:
bayesplot,posterior, andpriorsense; for Python:arviz
The exercises can also be viewed online: R or Python
An online environment is available here: binder
Overview
When working with Bayesian models, a range of related tasks must be addressed beyond inference itself. These include:
- Diagnosing the quality of the inferencial method (MCMC, VI, …). As we usually use numerical methods to perform inference.
- Model checking and criticism, which includes posterior predictive checks, prior predictive checks, prior/likelihood sensitivity analysis.
- Model comparison
To simplify the workflow of performing these tasks, we can use some tools. The ones we are going to cover in this tutorial are:
- R
- posterior: Conversion, manipulation, and summarization of draws from posterior and prior distributions.
- bayesplot: Visual checks and summaries.
- priorsense: Prior diagnostics and sensitivity analysis.
- Python
- arviz: a meta-package that imports all the packages bellow under a unified namespace.
- arviz-base: Data related functionality, including converters from different PPLs.
- arviz-stats: Statistical functions and diagnostics.
- arviz-plots: Visual checks and summaries built on top of arviz-stats and arviz-base.
- arviz: a meta-package that imports all the packages bellow under a unified namespace.