About

Richard McElreath’s Statistical Rethinking: A Bayesian Course with Examples in R and Stan is a dangerous book, for it not only explains Bayesian inference in an interesting and cogent way, but also convinces you that, just perhaps, with enough courage and enough practice, you too can fashion golems from the digital clay.

Under its spell, I decided that, rather than make good use of the many excellent internet resources in R that guide the intrepid novice through each set of the book’s hands-on exercises, I would instead use Python to work through the practice sets and in so doing teach myself the PyMC3 library. I realize now that this is akin to learning Hebrew by studying Kabbalah: though Malkuth may be in Kether, it was definitely slow going.

The reason for this is simple. While the many code examples that run throughout Statistical Rethinking have been converted from R into Python by the talented developers of PyMC3 (an invaluable asset when making your way through the main text), when it comes to working through the practice sets at the end of each chapter, Python code solutions only exist for half of the exercises, and almost all of those lie in the last half of the book. With no clear path between chapter two and ten, there was a marked increase in the amount of time it took me to complete the exercises, which in turn stalled my progression through the book.

This website is my attempt to bridge that gap and trace a path through the book’s middle, both for others who may find it useful and for my future self who certainly will. The site contains an entry for every chapter of the book; each entry contains both an overview of the chapter sections (from the 1st edition) as well as solutions in Python for every exercise in that chapter’s practice set.

I am indebted to the work of others much abler than I for both the form and content of many of these exercise solutions. In particular, the code created by the developers at PyMC3 and the insightful blog posts by Jeffrey Girard have served as ever-helpful guides while finding my way. Any stumbles or missteps are wholly my own.



Kircher's Tree of Life