I was trying to follow the solution to the 'urn type' probability problem with M&M's from this page -> http://allendowney.blogspot.com/2011/10/all-your-bayes-are-belong-to-us.html
I have reproduced the problem below, but what I don't get is the skipped steps after he says
Plugging the likelihoods and the priors into Bayes's theorem, we get P(A|E) = 40 / 54 ~ 0.74 "
I understand the formula:
P(E) P(A|E) = P(A) P(E|A)
=>
P(A|E) = P(A) P(E|A)
-----------
P(E)
And I got this far:
P(A) = .5
P(E|A) = .2 * .2
P(A|E) = (.5) (.2) (.2)
-----------
P(E)
But I am stuck on how the author of the post calculated P(E)
(the probability of the evidence). Any guidance much appreciated !
M&M Problem
The blue M&M was introduced in 1995. Before then, the color mix in a bag of plain M&Ms was (30% Brown, 20% Yellow, 20% Red, 10% Green, 10% Orange, 10% Tan). Afterward it was (24% Blue , 20% Green, 16% Orange, 14% Yellow, 13% Red, 13% Brown).
A friend of mine has two bags of M&Ms, and he tells me that one is from 1994 and one from 1996. He won't tell me which is which, but he gives me one M&M from each bag. One is yellow and one is green. What is the probability that the yellow M&M came from the 1994 bag?
Hypotheses:
A: Bag #1 from 1994 and Bag #2 from 1996
B: Bag #2 from 1994 and Bag #1 from 1996
Again, P(A) = P(B) = 1/2.
The evidence is: E: yellow from Bag #1, green from Bag #2
We get the likelihoods by multiplying the probabilities for the two M&M:
P(E|A) = (0.2)(0.2) P(E|B) = (0.1)(0.14)
For example, P(E|B) is the probability of a yellow M&M in 1996 (0.14) times the probability of a green M&M in 1994 (0.1).
Plugging the likelihoods and the priors into Bayes's theorem, we get P(A|E) = 40 / 54 ~ 0.74
Notice that: \begin{align*} \Pr[E] &= \Pr[E \text{ and } (A \text{ or } B)] &\text{since $A$ and $B$ are the only two possibilities}\\ &= \Pr[(E \text{ and } A) \text{ or } (E \text{ and }B)] \\ &= \Pr[E \text{ and } A] + \Pr[E\text{ and }B] &\text{since $A$ and $B$ are mutually exclusive}\\ &= \Pr[A]\Pr[E \mid A] + \Pr[B]\Pr[E \mid B] \\ &= \frac{1}{2}(0.2)(0.2) + \frac{1}{2}(0.14)(0.1) \\ &= 0.027 \end{align*}