Notes on Statistical Rethinking

This website contains my notes and code as I work through Richard McElreath’s 2025 course on his book Statistical Rethinking. A course in Bayesian statistics, Rethinking is code-heavy and meant to be read sequentially, not as a reference. McElreath offers his flipped instruction course locally, also publishing the lectures online.

Organization

The repository is organized into separate quarto files, which are stitched together in _quarto.yml.

  • book-notes/: contains notes and exercises directly from the textbook
  • course-notes/: contains notes from pre-recorded lectures and slides
  • homework/: contains homework solutions

Dependencies

The quarto notebooks use both R and Python in their code.

Quarto

First, install Quarto.

Python

Install dependencies using uv:

uv sync

This creates a virtual environment and installs packages from the lock file.

Note: pymc compiles code at runtime, utilizing the g++ compiler it finds in the PATH.

R

This project uses R 4.5.2, which can be installed using rig:

rig add 4.5.2

Then, use rv to install the R dependencies:

rv sync

Hunspell

You’ll need to have Hunspell installed for the spellcheck quarto extension to work.

Windows:

choco install hunspell.portable

Mac:

brew install hunspell

Linux:

sudo apt-get install hunspell

en_US dictionary

After installing Hunspell, you must install the en_US dictionary.

Windows/Mac:

  1. Download the dictionary files (both files: .dic and .aff).
  2. Place them in hunspell’s dictionary SEARCH PATH.
  • To add a new directory to the search path, add the directory to the DICPATH environment variable.
  • To view the search path, use hunspell -D:

Linux:

sudo apt-get install hunspell-en-us

Build

After installing the necessary dependencies, build the project:

quarto preview