# Coin tossing posterior density calculation

I know that my prior distribution is Beta(3,3) and that after tossing 12 coins, the number of 'heads' is less than 4 but I don't know the exact number. How do I calculate the posterior density?

What I've tried to do is:

If $$X=\#$$ of heads in $$n=12$$ tosses then $$X\sim Bin(12,\theta)$$

$$\pi(\theta|x)=\frac{p(x|\theta)\pi(\theta)}{f(x)}$$

Where $$f(x)$$ is the marginal density of the Likelihood.

I tried using 4 cases for $$X={0,1,2,3}$$

And calculate 4 different values of the posterior density. But is that correct?

What use is four posterior densities? I would have thought you wanted one. It would be a weighted average of them, but perhaps difficult to find the weights.

If $$p$$ is the probability of a head then, if my calculations are correct,

• The prior density is proportional to $$p^2(1-p)^2$$ from your Beta distribution;

• The likelihood given $$3$$ or fewer heads from $$12$$ attempts is proportional to $${12 \choose 0}(1-p)^{12}+{12 \choose 1}p(1-p)^{11}+{12 \choose 2}p^2(1-p)^{10}+{12 \choose 3}p^3(1-p)^9$$; and

• the posterior density is proportional to the product of these, but needs to integrate to $$1$$ over $$[0,1]$$

which suggests to me a posterior density of $$\dfrac{185640}{1271} p^2(1-p)^{11}\left(1+9p+45p^2+165p^3\right)$$

which is in a sense a weighted average of $$\operatorname{Beta}(3,15)$$, $$\operatorname{Beta}(4,14)$$, $$\operatorname{Beta}(5,13)$$ and $$\operatorname{Beta}(6,12)$$ densities, but I do not see a quicker way which involves calculating the weights required

In the chart below, the information from the observation has shifted the red prior density to the blue posterior density