Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|cite|improve this question
Are you using two letters, $x$ and $p$, to refer to the same thing? – Michael Hardy May 30 '14 at 21:25
up vote 0 down vote accepted

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.

share|cite|improve this answer
thanks Michael. I realize that i might miss essential mathematical background here - but what is the link between the beta(2,2) and the dummy variable r with the form 6r(1−r)? would love to study this more - let me know if u have a good link / reference – user1885116 May 30 '14 at 22:04
The function $r\mapsto6r(1-r)$ on the interval $0<r<1$ is the Beta(2,2) density. – Michael Hardy May 30 '14 at 22:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.