---
title: "Bayesian analysis example: Identifying a weighted coin"
canonical: "https://modelassist.epixanalytics.com/space/EA/26575395/Bayesian%20analysis%20example%3A%20Identifying%20a%20weighted%20coin"
format: markdown
---
|  |
| --- |
| <span style="color: #000000">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?</span> |


 

<span style="color: #000000">Let's start by noting that the probability that the coin is weighted is either zero or one: it either is </span>*<span style="color: #000000">not</span>*<span style="color: #000000"> the weighted coin or it </span>*<span style="color: #000000">is</span>*<span style="color: #000000">. 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:</span>

 

<span style="color: #000000">**Prior**</span>

p<span style="color: #000000">(fair) = 0.75</span>

p<span style="color: #000000">(weighted) = 0.25</span>

<span style="color: #000000">**Likelihood**</span>

<span style="color: #000000">*l*</span><span style="color: #000000">(head|fair) = 0.5</span>

l(head|weighted) = 0.8

<span style="color: #000000">**Posterior**</span>

<span style="color: #000000">f(fair|head) = 0.75*0.5/(0.75*0.5+0.25*0.8) = 0.652..</span>

<span style="color: #000000">f(weighted|head) = 0.25*0.8/(0.75*0.5+0.25*0.8) = 0.348..</span>

 

 

<span style="color: #000000">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.</span>

 

<span style="color: #000000">Let's toss the coin </span>*<span style="color: #000000">another</span>*<span style="color: #000000"> three times, and let's say you observed a head each time. Then, we would have:</span>

 

<span style="color: #000000">**Prior**</span>

p<span style="color: #000000">(fair) = 0.652..</span>

p<span style="color: #000000">(weighted) = 0.348..</span>

<span style="color: #000000">**Likelihood**</span>

*l*(head|fair) = (0.5)<sup>3</sup>

l(head|weighted) = (0.8)<sup>3</sup>

<span style="color: #000000">**Posterior**</span>

<span style="color: #000000">f(fair|head) = 0.652*0.125/(0.652*0.125+0.348*0.512) = 0.314..</span>

<span style="color: #000000">f(weighted|head) = 0.25*0.8/(0.652*0.125+0.348*0.512) = 0.686..</span>

 

<span style="color: #000000">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.</span>

 

<span style="color: #000000">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.</span>

 

 

 

---