Chapter 2. Bayes’s Theorem
In the previous chapter, we derived Bayes’s theorem:
As an example, we used data from the General Social Survey and Bayes’s theorem to compute conditional probabilities. But since we had the complete dataset, we didn’t really need Bayes’s theorem. It was easy enough to compute the left side of the equation directly, and no easier to compute the right side.
But often we don’t have a complete dataset, and in that case Bayes’s theorem is more useful. In this chapter, we’ll use it to solve several more challenging problems related to conditional probability.
The Cookie Problem
We’ll start with a thinly disguised version of an urn problem:
Suppose there are two bowls of cookies.
Bowl 1 contains 30 vanilla cookies and 10 chocolate cookies.
Bowl 2 contains 20 vanilla cookies and 20 chocolate cookies.
Now suppose you choose one of the bowls at random and, without looking, choose a cookie at random. If the cookie is vanilla, what is the probability that it came from Bowl 1?
What we want is the conditional probability that we chose from Bowl 1 given that we got a vanilla cookie, .
But what we get from the statement of the problem is:
-
The conditional probability of getting a vanilla cookie, given that we chose from Bowl 1, and
-
The conditional probability of getting a vanilla cookie, given that we chose from Bowl 2, .
Bayes’s theorem tells us how they are related: ...
Get Think Bayes, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.