Suppose I have a coin.
The probability of heads is unknown.
I toss the coin 9 times and get 4 heads. What is the likelihood that probability of heads(Ph) is 0.5
What I have tried till now
Likelihood of Ph being 0.5 given I have 4 heads from 9 tosses = Probability of getting 4 heads from 9 tosses when Ph is 0.5/Probability of getting 4 heads from 9 tosses when Ph varies from 0 to 1
In equation form:
P(Ph=0.5|4 heads from 9 tosses) = P(4 heads from 9 tosses|Ph=0.5)/P(getting 4 heads from 9 tosses)
Since coin tosses follow binomial distribution
$P(4 heads from 9 tosses|Ph=0.5) = 9C4 (0.5^4) * (1-0.5)^5 \tag{1}$
$P(getting 4 heads from 9 tosses) = 9C4 \int_0^1 (Ph^4)(1-Ph)^5 \, dPh \tag{2}$
where Ph varies from 0 to 1
But dividing eqn (1) and (2) yields a number greater than 1.
What am I doing wrong?
The likelihood is only the numerator of your calculation
$L(\frac{1}{2})=\binom{9}{4}(\frac{1}{2})^9\approx 0.246$
what you were triyng to calculate is the posterior density of $\theta$
$$f(\theta|\mathbf{x})=\frac{\binom{9}{4}\theta^4(1-\theta)^5}{\int_0^1 \binom{9}{4}p^4(1-p)^5 dp}=1260\cdot\theta^4(1-\theta)^5$$
Which is a $Beta(5;6)$ distribution
Please, for future posts, use MathJax