Statistical Rethinking is an incredible introductory book to Bayesian Statistics. It follows a Jaynesian and practical approach with very good examples and clear explanations.
In this repository we port the book's original code in R and Stan to Python and PyMC. We attempt to reproduce the examples as faithfully as possible while expressing them in a Pythonic and PyMConic way.
All contributions are welcome!
Feel free to send PRs to fix errors, improve the code, or make comments that could help users of this repository and readers of the book. When submitting PRs, please make sure the notebooks are formatted according to the PyMC NB style guide.
You can also join the discussion on Gitter.
To install the dependencies to run these notebooks, you can use Anaconda. Once you have installed Anaconda, run:
conda env create -f environment.yml
to install all the dependencies into an isolated environment.
Activate the environment by running:
source activate stat-rethink2-pymc
To use the notebooks you first have to register your new environment as a valid notebook kernel:
python -m ipykernel install --user --name stat-rethink2-pymc3 --display-name "Python 3.10 (stat-rethink2-pymc3)"
You can start a notebook by running:
jupyter notebook
or use the more modern jupyter lab:
jupyter lab
from the root directory.
Work is on-going to update these notebooks to be compatible with PyMC v4. Currently chapters 2 through 14 have been converted.
If you wish to run these notebooks, please create the v4 environment by running:
conda env create -f environment_v4.yml
and activate it with:
source activate stat-rethink2-pymc_v4
Statistical Rethinking with Python and PyMC by All Contributors is licensed under a Creative Commons Attribution 4.0 International License.