Bayesian Statistics Made Simple
by Allen B. Downey
Read Think Bayes 2e online (and follow the links there to the Jupyter notebooks).
The code for this book is in this GitHub repository.
This page is for the second edition of Think Bayes. The first edition is still available here.
Think Bayes is an introduction to Bayesian statistics using computational methods.
The premise of this book, and the other books in the Think X series, is that if you know how to program, you can use that skill to learn other topics.
Most books on Bayesian statistics use mathematical notation and present ideas in terms of mathematical concepts like calculus. This book uses Python code instead of math, and discrete approximations instead of continuous functions. As a result, what would be an integral in a math book becomes a summation, and most operations on probability distributions are loops or array operations.
I think this presentation is easier to understand, at least for people with programming skills. It is also more general because when we make modeling decisions, we can choose the most appropriate model without worrying too much about whether the model lends itself to conventional analysis. Also, it provides a smooth development path from simple examples to real-world problems.
What’s new in the second edition?
- I wrote a new Chapter 1 that introduces conditional probability using the Linda the Banker problem and data from the General Social Survey.
- I added new chapters on survival analysis, linear regression, logistic regression, conjugate priors, MCMC, and ABC.
- I added a lot of new examples and exercises, most from classes I taught using the first edition.
- I rewrote all of the code using NumPy, SciPy, and Pandas (rather than basic Python types). The new code is shorter, clearer, and faster!
- For every chapter, there’s a Jupyter notebook where you can read the text, run the code, and work on exercises. You can run the notebooks on your own computer or, if you don’t want to install anything, you can run them on Colab.
More generally, the second edition reflects everything I’ve learned in the 10 years since I started the first edition, and it benefits from the comments, suggestions, and corrections I’ve received from readers.
Think Bayes is a Free Book, which means that you are free to copy, distribute, and modify it, as long as you attribute the work, share alike, and don’t use it for commercial purposes.
Other Free Books by Allen Downey are available from Green Tea Press.