Think Bayes, 2nd Edition

Book description

If you know how to program, you're ready to tackle Bayesian statistics. With this book, you'll learn how to solve statistical problems with Python code instead of mathematical formulas, using discrete probability distributions rather than continuous mathematics. Once you get the math out of the way, the Bayesian fundamentals will become clearer and you'll begin to apply these techniques to real-world problems.

Bayesian statistical methods are becoming more common and more important, but there aren't many resources available to help beginners. Based on undergraduate classes taught by author Allen B. Downey, this book's computational approach helps you get a solid start.

  • Use your programming skills to learn and understand Bayesian statistics
  • Work with problems involving estimation, prediction, decision analysis, evidence, and Bayesian hypothesis testing
  • Get started with simple examples, using coins, dice, and a bowl of cookies
  • Learn computational methods for solving real-world problems

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Who Is This Book For?
    2. Modeling
    3. Working with the Code
    4. Installing Jupyter
    5. Conventions Used in This Book
    6. O’Reilly Online Learning
    7. How to Contact Us
    8. Contributor List
  2. 1. Probability
    1. Linda the Banker
    2. Probability
    3. Fraction of Bankers
    4. The Probability Function
    5. Political Views and Parties
    6. Conjunction
    7. Conditional Probability
    8. Conditional Probability Is Not Commutative
    9. Condition and Conjunction
    10. Laws of Probability
      1. Theorem 1
      2. Theorem 2
      3. Theorem 3
      4. The Law of Total Probability
    11. Summary
    12. Exercises
  3. 2. Bayes’s Theorem
    1. The Cookie Problem
    2. Diachronic Bayes
    3. Bayes Tables
    4. The Dice Problem
    5. The Monty Hall Problem
    6. Summary
    7. Exercises
  4. 3. Distributions
    1. Distributions
    2. Probability Mass Functions
    3. The Cookie Problem Revisited
    4. 101 Bowls
    5. The Dice Problem
    6. Updating Dice
    7. Summary
    8. Exercises
  5. 4. Estimating Proportions
    1. The Euro Problem
    2. The Binomial Distribution
    3. Bayesian Estimation
    4. Triangle Prior
    5. The Binomial Likelihood Function
    6. Bayesian Statistics
    7. Summary
    8. Exercises
  6. 5. Estimating Counts
    1. The Train Problem
    2. Sensitivity to the Prior
    3. Power Law Prior
    4. Credible Intervals
    5. The German Tank Problem
    6. Informative Priors
    7. Summary
    8. Exercises
  7. 6. Odds and Addends
    1. Odds
    2. Bayes’s Rule
    3. Oliver’s Blood
    4. Addends
    5. Gluten Sensitivity
    6. The Forward Problem
    7. The Inverse Problem
    8. Summary
    9. More Exercises
  8. 7. Minimum, Maximum, and Mixture
    1. Cumulative Distribution Functions
    2. Best Three of Four
    3. Maximum
    4. Minimum
    5. Mixture
    6. General Mixtures
    7. Summary
    8. Exercises
  9. 8. Poisson Processes
    1. The World Cup Problem
    2. The Poisson Distribution
    3. The Gamma Distribution
    4. The Update
    5. Probability of Superiority
    6. Predicting the Rematch
    7. The Exponential Distribution
    8. Summary
    9. Exercises
  10. 9. Decision Analysis
    1. The Price Is Right Problem
    2. The Prior
    3. Kernel Density Estimation
    4. Distribution of Error
    5. Update
    6. Probability of Winning
    7. Decision Analysis
    8. Maximizing Expected Gain
    9. Summary
    10. Discussion
    11. More Exercises
  11. 10. Testing
    1. Estimation
    2. Evidence
    3. Uniformly Distributed Bias
    4. Bayesian Hypothesis Testing
    5. Bayesian Bandits
    6. Prior Beliefs
    7. The Update
    8. Multiple Bandits
    9. Explore and Exploit
    10. The Strategy
    11. Summary
    12. More Exercises
  12. 11. Comparison
    1. Outer Operations
    2. How Tall Is A?
    3. Joint Distribution
    4. Visualizing the Joint Distribution
    5. Likelihood
    6. The Update
    7. Marginal Distributions
    8. Conditional Posteriors
    9. Dependence and Independence
    10. Summary
    11. Exercises
  13. 12. Classification
    1. Penguin Data
    2. Normal Models
    3. The Update
    4. Naive Bayesian Classification
    5. Joint Distributions
    6. Multivariate Normal Distribution
    7. A Less Naive Classifier
    8. Summary
    9. Exercises
  14. 13. Inference
    1. Improving Reading Ability
    2. Estimating Parameters
    3. Likelihood
    4. Posterior Marginal Distributions
    5. Distribution of Differences
    6. Using Summary Statistics
    7. Update with Summary Statistics
    8. Comparing Marginals
    9. Summary
    10. Exercises
  15. 14. Survival Analysis
    1. The Weibull Distribution
    2. Incomplete Data
    3. Using Incomplete Data
    4. Light Bulbs
    5. Posterior Means
    6. Posterior Predictive Distribution
    7. Summary
    8. Exercises
  16. 15. Mark and Recapture
    1. The Grizzly Bear Problem
    2. The Update
    3. Two-Parameter Model
    4. The Prior
    5. The Update
    6. The Lincoln Index Problem
    7. Three-Parameter Model
    8. Summary
    9. Exercises
  17. 16. Logistic Regression
    1. Log Odds
    2. The Space Shuttle Problem
    3. Prior Distribution
    4. Likelihood
    5. The Update
    6. Marginal Distributions
    7. Transforming Distributions
    8. Predictive Distributions
    9. Empirical Bayes
    10. Summary
    11. More Exercises
  18. 17. Regression
    1. More Snow?
    2. Regression Model
    3. Least Squares Regression
    4. Priors
    5. Likelihood
    6. The Update
    7. Marathon World Record
    8. The Priors
    9. Prediction
    10. Summary
    11. Exercises
  19. 18. Conjugate Priors
    1. The World Cup Problem Revisited
    2. The Conjugate Prior
    3. What the Actual?
    4. Binomial Likelihood
    5. Lions and Tigers and Bears
    6. The Dirichlet Distribution
    7. Summary
    8. Exercises
  20. 19. MCMC
    1. The World Cup Problem
    2. Grid Approximation
    3. Prior Predictive Distribution
    4. Introducing PyMC3
    5. Sampling the Prior
    6. When Do We Get to Inference?
    7. Posterior Predictive Distribution
    8. Happiness
    9. Simple Regression
    10. Multiple Regression
    11. Summary
    12. Exercises
  21. 20. Approximate Bayesian Computation
    1. The Kidney Tumor Problem
    2. A Simple Growth Model
    3. A More General Model
    4. Simulation
    5. Approximate Bayesian Computation
    6. Counting Cells
    7. Cell Counting with ABC
    8. When Do We Get to the Approximate Part?
    9. Summary
    10. Exercises
  22. Index

Product information

  • Title: Think Bayes, 2nd Edition
  • Author(s): Allen B. Downey
  • Release date: May 2021
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492089469