Coin Toss with Probability Either 0.5 or Uniformly Distributed

104 Views Asked by At

I am attempting to answer the following question from my actuarial exams:

enter image description here

We are asked to find $P(p=0.5|X=7)$.

Using Bayes Rule, I believe this is

$$P(p=0.5|X=7) = \frac{P(X=7|p=0.5)P(p=0.5)}{P(X=7|p=0.5)P(p=0.5) + P(X=7|p \sim Unif[0.5,1])P(p \sim Unif[0.5,1])}$$

Straightforwardly, using $X \sim Bin(8,p)$:

$$P(X=7|p=0.5)P(p=0.5) = {8 \choose 7}0.5^70.5 \times 0.8$$

I am less sure of $P(X=7|p \sim Unif[0.5,1])P(p \sim Unif[0.5,1])$, if even this is the right expression. Given it's continuous, I thought it might be:

$$P(X=7|p \sim Unif[0.5,1])P(p \sim Unif[0.5,1]) = \int^1_{0.5}{P(x|p)f(p) dp}$$

where $P(x|p) = {8 \choose 7}p^7(1-p)$ and $f(p) = 2$ (being the pdf of $Unif[0.5,1]$). But this doesn't account for the probability of p being uniformly distributed, $P(p \sim Unif[0.5,1]) = 0.2$.

What is the correct way to think about this?

Many thanks

Steven

1

There are 1 best solutions below

3
On

The prior distribution for $p$ is a mixed discrete-continuous distribution that is amenable to being handled with a hierarchical model: Let $\theta \sim \operatorname{Bernoulli}(0.8)$, so that $$p \mid \theta = 0 \sim \operatorname{Uniform}(0.5,1), \\ \Pr[p = 0.5 \mid \theta = 1] = 1;$$ that is to say, $p \mid \theta = 1$ has a degenerate distribution.

Then we note that the conditional probability of observing $X$ successes in $n$ trials is binomial with parameters $n$ and $p$, i.e., $$\Pr[X = x \mid p] = \binom{n}{x} p^x (1-p)^{n-x}.$$ So the unconditional probability of observing $X$ successes in $n$ trials may be found by conditioning on $\theta$: $$\begin{align} \Pr[X = x] &= \Pr[X = x \mid \theta = 0] \Pr[\theta = 0] + \Pr[X = x \mid \theta = 1]\Pr[\theta = 1] \\ &= (0.2) \int_{p = 0.5}^1 \Pr[X = x \mid p]f_p(p) \, dp + (0.8) \Pr[X = x \mid p = 0.5] \\ &= (0.2) \int_{p=0.5}^1 2 \binom{n}{x} p^x (1-p)^{n-x} \, dp + (0.8) \binom{n}{x} 2^{-n}. \end{align}$$ For the choices $n = 8, x = 7$, we get $$\Pr[X = 7] = \frac{251}{5760} + \frac{1}{40} = \frac{79}{1152}.$$ Therefore, the posterior probability that $p = 0.5$ is $$\Pr[p = 0.5 \mid X = 7] = \frac{\Pr[X = 7 \mid p = 0.5]\Pr[p = 0.5]}{\Pr[X = 7]} = \frac{\binom{8}{7}2^{-8} (0.8)}{\frac{79}{1152}} = \frac{144}{395}.$$