Home page for the book Regression and Other Stories by Andrew Gelman, Jennifer Hill, and Aki Vehtari, including the code and data.

Book information

Back cover text: Many textbooks on regression focus on theory and the simplest of examples. Real statistical problems, however, are complex and subtle. This is not a book about the theory of regression. It is a book about how to use regression to solve real problems of comparison, estimation, prediction, and causal inference. It focuses on practical issues such as sample size and missing data and a wide range of goals and techniques. It jumps right in to methods and computer code you can use fresh out of the box.

The book has been sent to the publisher and will be available in July 2020.

If you notice an error, submit an issue at https://github.com/avehtari/ROS-Examples/issues or send an email.


Code and data

Code and data by chapters

The folders below (ending /) point to the code (.R and .Rmd) and data folders in github, and .html -files point to pretty notebooks. Most examples have cleaned data in csv file in data subfolder for easy experimenting. The data subfolders have also the raw data and *_setup.R file showing how the data cleaning has been done.


1 Introduction

2 Data and measurement

3 Some basic methods in mathematics and probability

4 Generative models and statistical inference

5 Simulation

6 Background on regression modeling

7 Linear regression with a single predictor

8 Fitting regression models

9 Prediction and Bayesian inference

10 Linear regression with multiple predictors

11 Assumptions, diagnostics, and model evaluation

12 Transformations

13 Logistic regression

14 Working with logistic regression

15 Other generalized linear models

16 Design and sample size decisions

17 Poststratification and missing-data imputation

18 Causal inference basics and randomized experiments

19 Causal inference using regression on the treatment variable

20 Observational studies with all confounders assumed to be measured

21 More advanced topics in causal inference

22 Advanced regression and multilevel models

Appendix A


Code and data alphabetically

The folders below (ending /) point to the code (.R and .Rmd) and data folders in github, and .html -files point to pretty notebooks. Most examples have cleaned data in csv file in data subfolder for easy experimenting. The data subfolders have also the raw data and *_setup.R file showing how the data cleaning has been done.