Linear Models in Statistical Rethinking

Summary

Chapter 4 of Statistical Rethinking builds Bayesian linear regression from scratch. Why normal distributions arise from addition (CLT), how to write models in mathematical notation and translate to R code, and how to generate posterior predictions with uncertainty intervals.

Why Normal Distributions Are Normal

The Gaussian distribution arises naturally from addition of many small effects (Central Limit Theorem). McElreath demonstrates this with a soccer field simulation: random steps left/right converge to a bell curve regardless of step size distribution.

Two justifications for using Gaussian likelihoods:

  1. Ontological: many natural measurements are approximately Gaussian because they arise from additive processes
  2. Epistemological: the Gaussian is the maximum entropy distribution for a given mean and variance — it assumes the least about the data

The Model Language

A complete Bayesian model specifies likelihood and priors:

The R map function fits this by finding the maximum a posteriori (MAP) estimate and approximating the posterior as multivariate Gaussian.

Prior Predictive Simulation

Always Simulate from Priors First

Before fitting, simulate predictions from the prior to check that your priors produce sensible outcomes. This is a key step in Bayesian workflow.

Generating Predictions

Three-step recipe for any fitted model:

  1. Use link to generate posterior distributions of at each predictor value
  2. Use mean/HPDI/PI to summarize those distributions
  3. Use sim to generate full posterior predictions (incorporating )

The two kinds of uncertainty:

  • Narrow interval (around ): uncertainty about the average outcome at each predictor value
  • Wide interval (from sim): uncertainty about individual observations, including residual variation

Polynomial Regression

Polynomial models can capture curvature but:

  • Hard to interpret coefficients
  • Better to use a mechanistic model when possible
  • Always standardize predictors first for numerical stability

See Also