Bayes - bias of a coin

756 Views Asked by At

struggling with a basic question on the bias of a coin. Assume that i believe, as prior, that a coin is 40% probable to be fair and 60% probable to be unfair, with the estimated prior bias following a symmetric beta distribution (e.g. beta distrution with α=2 and β=2). Assume that i flip the coin 10 times, and get 7 heads. I realize that the posterior must have something like the form of x * (coin=fair) + (1-x) * f(p|data), whereas x is the updated probability that the coin is fair (from prior of 40%), and f(p|data) = the conjugate of the prior beta, e.g. a beta distribution with α=2+7 and β=2+10-7. I presume that calculating the likelihood of the 7 heads under the fair assumption and the prior? beta distribution probably also plays a part, but cannot figure out how to connect the dots and calculate the value of x. pointers much appreciated!

1

There are 1 best solutions below

2
On BEST ANSWER

I'm going to use capital $R$ to refer to the Beta-distributed random variable, and $r$ as the dummy argument to its density function, which is $r\mapsto6r(1-r)$. I'll use $X$ to refer to the number of heads in $10$ trials. Then \begin{align} \Pr(X=7\mid R=r) & = \Pr(X=7\mid\text{fair})\Pr(\text{fair})+\Pr(X=7\mid\text{biased},R=r)\Pr(\text{biased}) \\[10pt] & = 0.4\binom{10}{7}\left(\frac 1 2 \right)^{10} + 0.6\binom{10}{7} r^7(1-r)^3 \\[10pt] & = L(r). \end{align} This is the likelihood function, and the content of your question suggests I should remind you not to confuse the word "likelihood" with the word "probability".

The factor $\dbinom{10}{7}$ will appear in both the numerator and the denominator when Bayes' theorem is apply, so ignore it. And ignore the $6$ mentioned above for the same reason.

The posterior density is therefore \begin{align} & \text{constant}\cdot \left(0.4 \left(\frac 1 2 \right)^{10} + 0.6 r^7(1-r)^3\right) r(1-r) \\[10pt] = {} & \text{constant}\cdot \left(5 + 768 r^7(1-r)^3\right) r(1-r) \end{align} for $0<r<1$ and $0$ elsewhere. Here I used $\left(0.4\left(\frac12\right)^{10},0.6\right) = 1280\left(5,768\right)$ (the common denominator is $1280$).

So the posterior is a mixture of two Beta distributions.