Skip to content


Repository files navigation

Doing Bayesian data analysis in brms and the tidyverse


Kruschke began the second edition of his text like this: "This book explains how to actually do Bayesian data analysis, by real people (like you), for realistic data (like yours)" (2015, p. 1). In the same way, this ebook is designed to help those real people do Bayesian data analysis. My contribution is converting Kruschke's JAGS code for use in Bürkner's brms package for fitting Bayesian regression models in R using Hamiltonian Monte Carlo. I also prefer plotting and data wrangling with the packages from the tidyverse. So we'll be using those methods, too.

This ebook is not meant to stand alone. It's a supplement to the second edition of Kruschke's Doing Bayesian data analysis: A tutorial with R, JAGS, and Stan. I follow the structure of his text, chapter by chapter, translating his analyses into brms and tidyverse code. However, the content herein departs at times from the source material. Bayesian data analysis with Hamiltonian Monte Carlo is an active area in terms of both statistical methods and software implementation. There are also times when my thoughts and preferences on Bayesian data analysis diverge a bit from Kruschke's. In those places of divergence, I often provide references and explanations.

The current 1.1.0 version is a full draft in the sense that it contains brms versions of all of Kruschke's JAGS and Stan models, excluding examples that are not possible with the brms paradigm. A few minor issues remain, which you can read about in the Issues section. You can find guidelines for contributing to this ebook in the Contributing section.