The computational companion

Scan it.
Run it.
Change it.

Book QR targets, runnable scripts, and selected R/Python examples—organised around the printed code boxes.

57 code boxes28 R targets29 Python targets
chapter06 / multiple_regression
# R
fit <- lm(price ~ living_area + monthly_fee,
          data = apartments)

# Python
fit = smf.ols(
  "price ~ living_area + monthly_fee",
  data=apartments
).fit()
Same model · two ecosystems

Book-to-browser bridge

Every QR opens
inspectable source.

The printed QR codes point to small, box-level files that mirror the code in the book. Use those for quick reference; use the full chapter scripts to run an example end to end.

All public targets

Find code by chapter.

02 · 6 boxes

Covariation in data

Correlation, ranks, and simple regression.

R · 3Python · 3
03 · 4 boxes

Probability & inference

Simulation, testing, and confidence intervals.

R · 2Python · 2
04 · 2 boxes

Population correlation

Inference for a population correlation.

R · 1Python · 1
05 · 5 boxes

Simple linear regression

Inference, robust errors, and simulation.

R · 2Python · 3
06 · 10 boxes

Multiple regression

Partial regression, F-tests, and intervals.

R · 5Python · 5
07 · 2 boxes

Nonlinear functional form

Air pollution and flexible specifications.

R · 1Python · 1
08 · 6 boxes

Dependent errors

Clustering, multilevel models, and fixed effects.

R · 3Python · 3
09 · 4 boxes

Binary outcomes

Logistic regression and predicted probabilities.

R · 2Python · 2
10 · 10 boxes

Prediction

Cross-validation, regularization, and trees.

R · 5Python · 5
11 · 4 boxes

Nonparametric regression

Regressograms, kernels, and nonparametric RD.

R · 2Python · 2
13 · 2 boxes

Causal analysis

Regression discontinuity and robust estimation.

R · 1Python · 1