## Setting I have a question on the ["Cookie Problem Revisited"][1] exercise from Allen Downey's Think Bayes 2e. The Bayes theorem is defined as: $$ P(H \mid E) = \frac{P(H) \ P(E \mid H)}{P(E)} $$ where $E$ is the evidence and H is the hypothesis. Let's consider the following examples: two bowls contain different cookies. - Bowl 1 contains 30 vanilla cookies and 10 chocolate cookies. - Bowl 2 contains 20 vanilla cookies and 20 chocolate cookies. We randomly chose a bowl and draw a vanilla cookie. What is the probability that it came from Bowl 1? $P(H=\text{Bowl 1}) = 0.5$ (we randomly select the bowl) $P(E=\text{vanilla} \mid H=\text{Bowl 1}) = 30/(30+10) = 3/4 $ $P(E=\text{vanilla}) = (30 + 20)/(30 + 20 + 10 + 20) = 5/8$ (vanilla cookies over total cookies) Then, the posterior $P(H=\text{Bowl 1} \mid E=\text{vanilla}) = 0.6 $. ## Question Now we place the vanilla cookie back into the bowl and draw a second cookie. We get vanilla again. We can use the posterior we have just calculated as the new prior. The posterior is now: $P(E=\text{vanilla} \mid H=\text{Bowl 1}) \times P(H=\text{previous posterior})$ as calculated earlier. However, the probability of the evidence must be different from what we computed earlier (vanilla cookies over total cookies), because otherwise the posterior for Bowl 1 and Bowl 2 would not sum up to 1 (I haven't expressed the posterior for Bowl 2 in this text to keep it simple). Why isn't the probability of the evidence equal to the ratio of vanilla cookies over total cookies when we draw multiple times? And how can we calculate it in this case? [1]: https://colab.research.google.com/github/AllenDowney/ThinkBayes2/blob/master/notebooks/chap03.ipynb#scrollTo=2tMuUCcT5lLk