Statistical Rethinking: A Bayesian Course with Examples in R and Stan, 1st Edition (Hardback) book cover

Statistical Rethinking

A Bayesian Course with Examples in R and Stan, 1st Edition

By Richard McElreath

Chapman and Hall/CRC

469 pages | 113 B/W Illus.

Purchasing Options:$ = USD
Hardback: 9781482253443
pub: 2015-12-21
SAVE ~$23.00
eBook (VitalSource) : 9781315372495
pub: 2018-01-03
from $57.50

FREE Standard Shipping!


Statistical Rethinking: A Bayesian Course with Examples in R and Stan builds readers’ knowledge of and confidence in statistical modeling. Reflecting the need for even minor programming in today’s model-based statistics, the book pushes readers to perform step-by-step calculations that are usually automated. This unique computational approach ensures that readers understand enough of the details to make reasonable choices and interpretations in their own modeling work.

The text presents generalized linear multilevel models from a Bayesian perspective, relying on a simple logical interpretation of Bayesian probability and maximum entropy. It covers from the basics of regression to multilevel models. The author also discusses measurement error, missing data, and Gaussian process models for spatial and network autocorrelation.

By using complete R code examples throughout, this book provides a practical foundation for performing statistical inference. Designed for both PhD students and seasoned professionals in the natural and social sciences, it prepares them for more advanced or specialized statistical modeling.

Web Resource

The book is accompanied by an R package (rethinking) that is available on the author’s website and GitHub. The two core functions (map and map2stan) of this package allow a variety of statistical models to be constructed from standard model formulas.


"… I am quite impressed by Statistical Rethinking … I like the highly personal style with clear attempts to make the concepts memorable for students by resorting to external concepts. … it introduces Bayesian thinking and critical modeling through specific problems and spelled out R codes, if not dedicated datasets. Statistical Rethinking manages this all-inclusive most nicely … an impressive book that I do not hesitate recommending for prospective data analysts and applied statisticians!"

Christian Robert (Université Paris-Dauphine, PSL Research University, and University of Warwick) on his blog, April 2016

"Statistical Rethinking is a fun and inspiring look at the hows, whats, and whys of statistical modeling. This is a rare and valuable book that combines readable explanations, computer code, and active learning."

—Andrew Gelman, Columbia University

"This is an exceptional book. The author is very clear that this book has been written as a course . . . Strengths of the book include this clear conceptual exposition of statistical thinking as well as the focus on applying the material to real phenomena."

Paul Hewson, Plymouth University, 2016

"The book contains a good selection of extension activities, which are labelled according to difficulty. There are occasional paragraphs labelled ‘rethinking’ or ‘overthinking’ that contain finer details. The presentation is replete with metaphors ranging from the ‘statistical Golems’ in Chapter 1 through ‘Monsters and Mixtures’ in Chapter 11 and ‘Adventures in Covariance’ in Chapter 13."

Diego Andrés Pérez Ruiz, University of Manchester

Table of Contents

The Golem of Prague

Statistical golems

Statistical rethinking

Three tools for golem engineering


Small Worlds and Large Worlds

The garden of forking data

Building a model

Components of the model

Making the model go



Sampling the Imaginary

Sampling from a grid-approximate posterior

Sampling to summarize

Sampling to simulate prediction



Linear Models

Why normal distributions are normal

A language for describing models

A Gaussian model of height

Adding a predictor

Polynomial regression



Multivariate Linear Models

Spurious association

Masked relationship

When adding variables hurts

Categorical variables

Ordinary least squares and lm



Overfitting, Regularization, and Information Criteria

The problem with parameters

Information theory and model performance


Information criteria

Using information criteria




Building an interaction

Symmetry of the linear interaction

Continuous interactions

Interactions in design formulas



Markov Chain Monte Carlo

Good King Markov and His island kingdom

Markov chain Monte Carlo

Easy HMC: map2stan

Care and feeding of your Markov chain



Big Entropy and the Generalized Linear Model

Maximum entropy

Generalized linear models

Maximum entropy priors


Counting and Classification

Binomial regression

Poisson regression

Other count regressions



Monsters and Mixtures

Ordered categorical outcomes

Zero-inflated outcomes

Over-dispersed outcomes



Multilevel Models

Example: Multilevel tadpoles

Varying effects and the underfitting/overfitting trade-off

More than one type of cluster

Multilevel posterior predictions



Adventures in Covariance

Varying slopes by construction

Example: Admission decisions and gender

Example: Cross-classified chimpanzees with varying slopes

Continuous categories and the Gaussian process



Missing Data and Other Opportunities

Measurement error

Missing data




About the Author

Richard McElreath is the director of the Department of Human Behavior, Ecology, and Culture at the Max Planck Institute for Evolutionary Anthropology. He is also a professor in the Department of Anthropology at the University of California, Davis. His work lies at the intersection of evolutionary and cultural anthropology, specifically how the evolution of fancy social learning in humans accounts for the unusual nature of human adaptation and extraordinary scale and variety of human societies.

About the Series

Chapman & Hall/CRC Texts in Statistical Science

Learn more…

Subject Categories

BISAC Subject Codes/Headings:
MATHEMATICS / Probability & Statistics / General