urn type problem with bayes theorem (and M&Ms) don't understand how probability of seeing 'evidence' was calculated.

2.9k Views Asked by At

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

2

There are 2 best solutions below

2
On BEST ANSWER

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*}

0
On

A = given yellow M & M from 1994 bag B = given yellow and green M & M

P(A) = .2

P(A and B) = .2 x .2 = .04
the above is to say, that a Yellow comes from A, with probability .2 AND the other (now necessarily from B) is Blue, with probability 0.2

for B to be true, Green was taken from either 1994 or 1996

P(B) = P(yellow from 1994)P(green from 1996) + P(green from 1994)P(yellow from 1996) = .2 x .2 + .1 x .14 = .04 + .014 = .054

P(A | B) = P(A and B) / P(B) = .04 / .054 = 0.74074

..................................................

I don't really agree with his hypothesis about bag A and bag B with probability 1/2, that isn't necessary, it is very confusing