My implementation of John K. Kruschke's Doing Bayesian Data Analysis 2nd edition using Python and Numpyro. This implementation is not comprehensive, I'll just focus on the generalized linear model only, which is from chapter 16 onward. Suggestions for improvement are welcome!
- Chapter 9: Hierarchical Models
- Chapter 10: Model Comparison and Hierarchical Modeling
- Chapter 12: Bayesian Approaches to Testing a Point ("Null") Hypothesis
- Chapter 16: Metric-Predicted Variable on One or Two Groups
- Chapter 17: Metric Predicted Variable with one Metric Predictor
- Chapter 18: Metric Predicted Variable with Multiple Metric Predictors
- Chapter 19: Metric Predicted Variable with One Nominal Predictor
- (WIP) Chapter 20: Metric Predicted Variable with Multiple Nominal Predictors
- Chapter 21: Dichotomous Predicted Variable
- Chapter 22: Nominal Predicted Variable
- Chapter 23: Ordinal Predicted Variable
- Chapter 24: Count Predicted Variable
This project uses a combination of Conda
and Poetry for dependencies management.
To install the dependencies for this project, make sure that you have conda
installed on your system.
First, create a virtual environment managed by conda
:
conda env create -f environment.yml
The above command will create a virtual environment named doing_bayes
and install poetry
package manager into that environment.
After that, activate the environment conda activate doing_bayes
and use poetry
to install the remaining dependencies:
poetry install
Activate the doing_bayes
environment,
and then start the jupyter-lab
server:
jupyter-lab --no-browser
Then, you can click on the link to open notebooks on your browsers.
Each chapter's notebook are a normal python script thanks to Jupytext. To generate a notebook for a chapter from the python script, you can follow this instruction.
My implementation refers to JWarmenhoven's implementation a lot, especially those figures with data and posterior predictive distributions.