Bayesian analysis example: identifying a weighted coin | Vose Software

Bayesian analysis example: identifying a weighted coin

You have four "loonies" (Canadian one dollar coins - they have a loon on the tail face) in your pocket. Three of them are regular coins, but the fourth is a weighted coin which has an 80% chance of landing heads up. You cannot tell the coins apart on inspection. You take a coin out of your pocket at random and toss it - it lands heads up. What is the probability that the coin is the weighted coin?

Let's start by noting that the probability that the coin is weighted is either zero or one: it either is not the weighted coin or it is. The problem should really be phrased "What confidence do you have that the tossed coin is weighted?" since you are only dealing with the state of your knowledge. When you took the coin out of your pocket but before you had tossed it, you might reasonably have said you were 0.25 confident that the coin in your hand was weighted and 0.75 confident it was not weighted. Performing a Bayesian inference after observing one head from one toss:


p(fair) = 0.75

p(weighted) = 0.25


l(head|fair) = 0.5

l(head|weighted) = 0.8


f(fair|head) = 0.75*0.5/(0.75*0.5+0.25*0.8) = 0.652..

f(weighted|head) = 0.25*0.8/(0.75*0.5+0.25*0.8) = 0.348..

You are now 65% (or so) confident the coin is fair and 35% confident that it is weighted, so your belief has not greatly changed by observing the coin toss.

Let's toss the coin another three times, and let's say you observed a head each time. Then, we would have:


p(fair) = 0.652..

p(weighted) = 0.348..


l(head|fair) = (0.5)3

l(head|weighted) = (0.8)3


f(fair|head) = 0.652*0.125/(0.652*0.125+0.348*0.512) = 0.314..

f(weighted|head) = 0.25*0.8/(0.652*0.125+0.348*0.512) = 0.686..

Note that we used the posterior from the first experiment as the prior for the second experiment. Of course it would not matter in which order we did the experiments, neither would it matter if we grouped all four tosses into one experiment, the posterior will work out the same.

If you kept tossing the coin and saw considerably more heads than tails, so you would become progressively more convinced that you had selected the weighted coin. Note that although this is a subjective analysis, the likelihood function supplies the required objectivity so that we alter our opinion in a manner that is appropriate to the weight of evidence.

See Also