Using Bayes Theorem to calculate the probability of a coin being biased given a specific test outcome

Suppose I have a bag full of coins (could be any amount). One of the coins has a bias 2/3 towards heads and all the rest are fair. A random coin is then picked from the bag and tossed 25 times (the same coin is tossed all 25 times), and these tosses can be viewed as a test of whether the coin is biased or fair.

My question is then; Can you use Bayes Theorem to calculate the probability of the coin being biased 2/3 towards heads, given that all 25 tosses comes out heads?

Intuitively I would think so, but surely I would need to know the prior probability of the coin being bias 2/3 towards heads, and I can't know that without knowing how many coins are in the bag to begin with..?

I do know the probability of the test resulting in 25 heads out of 25 tosses given that the coin is biased 2/3 towards heads (0.000031) as well as the probability of the test resulting in 25 heads out of 25 tosses given that the coin is not biased (fair) (0.000000745). But I can't seem to figure out how to calculate the probability of the coin being biased in the first place P(biased)...

Let's say that the test resulting in 25 times heads out of 25 tosses is a positive result. Bayes Theorem would then (in my mind) look like this:

P(Biased|Positive) = ( P(Positive|Biased) * P(Biased) ) / ( P(Positive|Biased) * P(Biased) + P(Positive|not Biased) * P(not Biased) )


But I don't know P(Biased)...

• Yes, your intuitive suspicion is correct. You do need to know how many coins there are in the bag. Suppose for example that the bag contains infinitely many coins. The probability of randomly choosing the biased coin would be zero, and getting 25 heads would make no difference to that. On the other hand, if there are only 10 coins, then choosing the biased one is quite possible. In that case it is almost certain a posteriori that you tossed the biased coin. – Gordon Smyth Nov 13 '17 at 3:36
• It would aye be easier if Rasmus knew how many coins were in the bag, Gordon, but that he very likely picked a bias one suggests that there is unlikely to be an infinate number unbiased ones to pick from. – R. Cox Jun 1 at 13:48

I think you need to know the number of coins. Intuitively if the number of coins is large, the probability of picking a biased coin is small.

Further, assume there are $$n$$ coins in the bag. $$P(Biased|Positive) = \frac{(\frac{2}{3})^{25} \times \frac{1}{n}} {(\frac{2}{3})^{25} \times \frac{1}{n} + (\frac{1}{2})^{25} \times \frac{n-1}{n}}$$.

$$\frac{1}{n}$$ cancels and it leaves $$n-1$$ in the denominator.

• There was only one bias coin in the bag and it seems like Rasmus very likely picked it so I think that most likely n=1 – R. Cox Jun 1 at 14:06