What and why

This ebook is based on the second edition of Richard McElreath’s (2020a) text, Statistical rethinking: A Bayesian course with examples in R and Stan. My contributions show how to fit the models he covered with Paul Bürkner’s brms package (Bürkner, 2017, 2018, 2020g), which makes it easy to fit Bayesian regression models in R (R Core Team, 2020) using Hamiltonian Monte Carlo. I also prefer plotting and data wrangling with the packages from the tidyverse (Wickham, 2019; Wickham et al., 2019). So we’ll be using those methods, too.

Caution: Work in progress

The inaugural 0.0.1 release contained first drafts of Chapters 1 through 9. The 0.0.2 update added drafts of Chapters 10 through 12. This 0.0.3 update adds drafts of Chapters 13 and 14, which introduce the multilevel model and related applications.

There is no timetable for this project, but I’ll update it periodically with new chapters and so on. To keep up with the latest changes, check in at the GitHub repository, https://github.com/ASKurz/Statistical_Rethinking_with_brms_ggplot2_and_the_tidyverse_2_ed, or follow my announcements on twitter at https://twitter.com/SolomonKurz.

Thank-you’s are in order

I’d like to thank the following for their helpful contributions:

Science is better when we work together.


Bürkner, P.-C. (2017). brms: An R package for Bayesian multilevel models using Stan. Journal of Statistical Software, 80(1), 1–28. https://doi.org/10.18637/jss.v080.i01

Bürkner, P.-C. (2018). Advanced Bayesian multilevel modeling with the R package brms. The R Journal, 10(1), 395–411. https://doi.org/10.32614/RJ-2018-017

Bürkner, P.-C. (2020g). brms: Bayesian regression models using ’Stan’. https://CRAN.R-project.org/package=brms

McElreath, R. (2020a). Statistical rethinking: A Bayesian course with examples in R and Stan (Second edition). CRC Press. https://xcelab.net/rm/statistical-rethinking/

R Core Team. (2020). R: A language and environment for statistical computing. R Foundation for Statistical Computing. https://www.R-project.org/

Wickham, H. (2019). tidyverse: Easily install and load the ’tidyverse’. https://CRAN.R-project.org/package=tidyverse

Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L. D., François, R., Grolemund, G., Hayes, A., Henry, L., Hester, J., Kuhn, M., Pedersen, T. L., Miller, E., Bache, S. M., Müller, K., Ooms, J., Robinson, D., Seidel, D. P., Spinu, V., … Yutani, H. (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686. https://doi.org/10.21105/joss.01686