avehtari/BDA_py_demos

Bayesian Data Analysis demos for Python

Jupyter Notebook

1,045

125 commits

updated Sep 19, 2025

See the code

README

Bayesian Data Analysis Python Demos

Binder to interactively run the IPython Notebooks in the browser.

This repository contains some Python demos for the book Bayesian Data Analysis, 3rd ed by Gelman, Carlin, Stern, Dunson, Vehtari, and Rubin (BDA3). See also Bayesian Data Analysis course material.

Currently there are demos for BDA3 Chapters 2, 3, 4, 5, 6, 10 and 11. Furthermore, cmdstanpy is also demoed.

Demos are in jupyter notebook (.ipynb) format. These can be directly previewed in GitHub without need to install or run anything.

Corresponding demos were originally written for Matlab/Octave by Aki Vehtari and translated to Python by Tuomas Sivula. Some improvements were contributed by Pellervo Ruponen and Lassi Meronen. There are also corresponding R demos.

Requirements

  • python
  • ipython
  • numpy
  • scipy
  • matplotlib
  • pandas (for some demos)
  • cmdstanpy (for some demos)
  • ArviZ (for some demos)

You can install all necessary packages with environment.yml file using conda or mamba:

conda env create -f environment.yml

or

mamba env create -f environment.yml
bayesian
bayesian-data-analysis
bayesian-inference
mcmc
python
stan

avehtari/BDA_py_demos

Bayesian Data Analysis demos for Python

Jupyter Notebook

1,045

125 commits

updated Sep 19, 2025

See the code

README

Bayesian Data Analysis Python Demos

Binder to interactively run the IPython Notebooks in the browser.

This repository contains some Python demos for the book Bayesian Data Analysis, 3rd ed by Gelman, Carlin, Stern, Dunson, Vehtari, and Rubin (BDA3). See also Bayesian Data Analysis course material.

Currently there are demos for BDA3 Chapters 2, 3, 4, 5, 6, 10 and 11. Furthermore, cmdstanpy is also demoed.

Demos are in jupyter notebook (.ipynb) format. These can be directly previewed in GitHub without need to install or run anything.

Corresponding demos were originally written for Matlab/Octave by Aki Vehtari and translated to Python by Tuomas Sivula. Some improvements were contributed by Pellervo Ruponen and Lassi Meronen. There are also corresponding R demos.

Requirements

  • python
  • ipython
  • numpy
  • scipy
  • matplotlib
  • pandas (for some demos)
  • cmdstanpy (for some demos)
  • ArviZ (for some demos)

You can install all necessary packages with environment.yml file using conda or mamba:

conda env create -f environment.yml

or

mamba env create -f environment.yml
bayesian
bayesian-data-analysis
bayesian-inference
mcmc
python
stan

Significant stargazers

Benjamin Eckel

126 followers · starred Jan 2018

Ahmad Alhour

613 followers · starred May 2020

hwalsuklee

936 followers · starred Feb 2017

Martin Jansche

68 followers · starred May 2019