About

About these notes

A self-study curriculum in applied Bayesian statistics, written as executable notebooks for the current PyMC stack and published here as readable pages.

Principles

  • Real data first. Every dataset is public, with its source cited where it is loaded. A few examples study systems for which no public data exist - chaos control in Lorenz models, the design of a heated plate, a morphogen gradient - and simulate them from published models and parameters; those pages say so in their header.
  • Honest results. Where a model under-covers, fails to mix or gives an inconclusive answer, the page says so. Several examples end with a negative result on purpose.
  • Current tools. PyMC 6, ArviZ 1 and PyTensor 3, whose APIs differ from most tutorials (posteriors are xarray DataTrees; nutpie is the default sampler when installed). E01 has a then-versus-now table.
  • Decisions, not just posteriors. Most analyses end with the quantity a reader acts on.

Running the notebooks

The environment is managed with uv:

git clone https://github.com/redam94/pymc-challenges.git
cd pymc-challenges
uv sync                            # PyMC 6, ArviZ 1, nutpie, JAX, JupyterLab, ...
uv run python -m pymc_challenges    # optional: download every dataset into data/
uv run jupyter lab notebooks

Every notebook has been measured to peak below 3 GB of memory. Multi-process samplers copy the model per chain; on a small machine prefer nutpie (threads) and keep to one notebook at a time.

Reading the pages

Pages are rendered from the executed notebooks without re-running them, so every number and figure is the one the code produced. Use Hide code at the top of a page to read the narrative and figures alone; the choice is remembered. Mathematics is typeset with MathJax.

Further reading

  • Gelman, Vehtari, Simpson et al. (2020). Bayesian Workflow. arXiv:2011.01808.
  • Gelman, Carlin, Stern, Dunson, Vehtari & Rubin (2013). Bayesian Data Analysis, 3rd ed.
  • McElreath (2020). Statistical Rethinking, 2nd ed.
  • Martin, Kumar & Lao (2021). Bayesian Modeling and Computation in Python.
  • The PyMC and ArviZ documentation.