Conditional probability question involving Bayes' theorem

508 Views Asked by At

A jar has 300 buttons in it. 299 buttons have one side red, the other side blue. One of the buttons has both sides blue. I randomly take a button from the jar and toss it 5 times getting 5 blues in a row. What is the probability I chose the special blue button?

I did: $$ \begin{align} P(\text{chose blue button}|\text{5 blue tosses}) &= \frac{P(\text{choose blue button and 5 blue tosses})}{P(\text{5 blue tosses})}\\ &= \frac{\frac{1}{300}\cdot 1^5}{\frac{299}{300} \left(\frac{1}{2}\right)^5 + \frac{1}{300}1^5} \end{align} $$ Is this correct?

2

There are 2 best solutions below

0
On BEST ANSWER

It is correct. Maybe it is more clear when it is written as

$$\begin{align}P(\text{chose blue }|\text{5 blue tosses}) &= \frac{P(\text{5 blue tosses|blue})P(\text{blue})}{P(\text{5 blue tosses|blue })P(\text{blue })+P(\text{5 blue tosses|other})P(\text{other})} \\[10pt] &= \frac{(1^5)\frac{1}{300}}{(1^5)\frac{1}{300}+(\frac{1}{2})^5\frac{299}{300}}\end{align}$$

2
On

Straightforward application of Bayes' Theorem. I agree with @msm that you have the right method and answer. Notice that your answer (approx 0.1) is substantially greater than just the probability (approx .003) of choosing the 'pure blue' button without conditional info from 'testing out' the button with 5 tosses.

Just for verification, I simulated the experiment 10 million times in R statistical software. Results are in reasonable agreement with your answer. (Because choosing a 'pure blue' button is so rare, such a simulated result may be accurate to only about 2, maybe 3, decimal places.)

 m = 10^7;  p = x = numeric(m)
 b = c(1, rep(.5, 299))     # buttons in jar
 for (i in 1:m) {
   p[i] = sample(b, 1)         # choose a button
   x[i] = rbinom(1, 5, p[i]) } # toss 5 times and count 'blue's
 mean(p == 1)                  # proportion of 'pure blue' buttons chosen
 ## 0.0033274
 1/300                    # compare
 ## 0.003333333
 mean(p[x==5] == 1)       # when get 5 'blues' what proportion 'pure blue' bottons
 ## 0.09672815
 1/(299/32 + 1)           # compare (your answer)
 ## 0.09667674