577
Views
0
CrossRef citations to date
0
Altmetric
Reviews of Books and Teaching Materials

Bayesian Modeling and Computation in Python

This book stands as one of the most recent in a genre that goes back a couple decades: Bayesian software as Bayesian pedagogy. Peter Congdon’s Bayesian Statistical Modeling (Citation2001) was perhaps the first notable title in this genre; although the title doesn’t call it out, the book emphasized implementation using BUGS or WinBUGS. A decade later, we have Doing Bayesian Data Analysis: A Tutorial with R and BUGS (Citation2010), where now the software has emerged in the title. As software changes, new volumes are called for—BUGS eventually gives way to Stan (in R) and we have titles such as Statistical Rethinking: A Bayesian Course with Examples in R and STAN (Citation2020). The year 2023 is soon upon us and the data analysis community—at least some substantial part of it—has migrated to Python, and so a new crop of Bayesian textbooks is due. The volume by Osvaldo, Kumar, and Lao seems to be a fine example of the species, as the authors are experts at statistical computation and have been instrumental in developing tools to put Bayesian methods in the hands of Python users.

With this historical backdrop we can now assess the book’s merits in two distinct respects: on the one hand, as a Bayesian textbook, and on the other hand, as an introduction to the Bayesian modeling frameworks provided in Python, specifically the PyMC3 and ArviZ libraries. On the first count, I find the book to be middling relative to other options that are either better organized, more succinct, or more rigorous. The authors concede that their audience are novice Bayesian models rather than true beginners, but even in that case much of the material would bewilder a newbie right off the bat or else would be summarily skipped. Anyone with the necessary background to be unintimidated by the first chapter is likely to find the review of logistic regression and cross-validation to be boring. I get the sense that the material is being laid down summarily to get to the real point: selling us on PyMC3. Thus, we have sections titles such as “Building the Design Matrix using Patsy.” If you know what a design matrix is and are curious how to build one in “Patsy,” then this is the book for you.

On this second count—qua (open-source) software advertisement—I feel that the book is more engaging than most. Chapter 9 on End to End Bayesian Workflows has an interesting applied example about airline flight delays and a subsection titled Understanding Your Audience, about how to communicate statistical ideas to a non-statistical audience. The book is strongest when it is most specific and where the authors can convey the working knowledge they have as data scientists working in industry (at Google). That said, I do wonder if a textbook is the best way to convey this kind of information, as opposed to, say, YouTube videos, podcasts, github repositories, or code notebooks with interactive examples. In particular, these alternative formats have the benefit that they do not have to dress themselves up as introductory (or intermediate) textbooks, with 50 page appendices on elementary topics and the boilerplate introductory paragraph on Thomas Bayes and how it was actually Laplace who invented Bayesian statistics.

In summary, the book is a mixed bag of introductory material, interesting examples and practical insights, and software specific how-tos. I do not see this book as suitable for any standard course, but should be of interest to R users who are Python-curious, although online resources (some by the same authors) may be the more expedient path to making that transition.

P. Richard Hahn
School of Mathematical and Statistical Sciences
Arizona State University
Tempe, AZ
[email protected]

References

  • Congdon, P. (2001), Bayesian Statistical Modeling, New York: Wiley.
  • Kruschke, J. K. (2010), Doing Bayesian Data Analysis: A Tutorial with R and BUGS, New York: Academic Press.
  • McElreath, R. (2020), Statistical Rethinking: A Bayesian Course with Examples in R and STAN, Boca Raton, FL: CRC Press.

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.