# Bayesian Hypothesis Testing with Fair Coin Flip

Bayesian binary hypothesis testing problem in equal priors and uniform cost assignment (i.e., $c_{ij}=1$ for $i \neq j$ otherwise $0$) setting:

Under hypothesis $\mathrm{H}_0$, the observation $Y$ is distributed with $p_0(y)$. Under hypothesis $\mathrm{H}_1$, first a fair coin is flipped and if it is tails, $Y$ is distributed with $p_{11}(y)$ and if it is heads, it is distributed with $p_{12}(y)$.

I think this question represents the case where a simple hypothesis ($\mathrm{H}_0$) is compared against a composite hypothesis ($\mathrm{H}_1$). To solve this question, I cannot just use the likelihood ratio test: $$\displaystyle\frac{p_0(y)}{p_1(y)}$$ since $p_1(y)$ is not a single distribution.Furthermore, I know that there is a generalized version of the ratio test as (as long as uniform cost assignment is valid): $$\frac{P(y|\Theta \in \Lambda_1)}{P(y|\Theta \in \Lambda_0)}$$ where $\Theta$ represents the different distributions that $Y$ can have under each hypothesis.

What I think the solution might be is: Under $\mathrm{H}_0$, $P(y|\Theta \in \Lambda_0)$ reduces to $p_0(y)$. But I am stuck at the evaluation of $P(y|\Theta \in \Lambda_1)$. I think I somehow need to find a relation between $\Lambda_0$ and $\Lambda_1$. However, I don't know how I can do that. Any help will be appreciated. Thanks in advance!

BTW, if my notation is confusing and if any point is unclear, I will do my best to clarify it.

• $p_1$ is a single distribution, $$p(y) = .5 p_{11}(y)+.5 p_{12}(y)$$ – Xi'an Nov 14 '16 at 7:17
• Thanks for the answer. So does it mean that $\mathrm{H_1}$ is not a composite hypothesis either? I am confused because I thought that if the observations have different distributions under a hypothesis, then this hypothesis is composite. – amipima Nov 14 '16 at 7:44
• The point is that $Y$ does not have several distributions under $\mathbf{H}_1$. It is a single distribution expressed as a mixture, hence with a Bernoulli latent variable. – Xi'an Nov 14 '16 at 9:26

One of the problems here is that you are using notation that is far too complicated for the question under consideration. This makes a very simple inference problem look far more complex than it is, and it taxes the reader by making them try to interpret large amounts of unecessary notation. In particular, since there are only two underlying hypotheses under consideration, the prior parameter can easily be represented as a simple binary variable, and the prior distribution for this parameter can be written as a single probability for one of its outcomes.

To reframe things more simply, let $$\theta \in \{ 0, 1 \}$$ denote the true underlying parameter of interest, determining the sampling the distributions. You then have the sampling model:

\begin{aligned} p(y | \theta = 0) &= p_0(y), \\[6pt] p(y | \theta = 1) &= p_1(y) = \tfrac{1}{2} \cdot p_{11}(y) + \tfrac{1}{2} \cdot p_{12}(y). \\[6pt] \end{aligned}

(As Xi'an has noted in the comments, the distribution $$p_1$$ is not composite --- it is just a simple mixture distribution determined by a fair coin-flip.) Let $$\omega \equiv \mathbb{P}(\theta = 1)$$ so that the prior distribution is:

$$\pi(\theta) = \text{Bern}(\theta|\omega) = \omega^\theta (1-\omega)^{1-\theta}.$$

The corresponding posterior distribution has probabilities:

\begin{aligned} \pi(\theta=0|y) &= \frac{\pi(0) \ p(y | \theta=0)}{p(y)} \\[6pt] &= \frac{\pi(0) \ p(y | \theta=0)}{\pi(0) \ p(y | \theta = 0) + \pi(1) \ p(y | \theta = 1)} \\[6pt] &= \frac{(1-\omega) \ p_0(y)}{(1-\omega) \ p_0(y) + \omega \ (\tfrac{1}{2} \cdot p_{11}(y) + \tfrac{1}{2} p_{12}(y))}, \\[12pt] \pi(\theta=1|y) &= \frac{\pi(1) \ p(y | \theta=1)}{p(y)} \\[6pt] &= \frac{\pi(1) \ p(y | \theta=1)}{\pi(0) \ p(y | \theta = 0) + \pi(1) \ p(y | \theta = 1)} \\[6pt] &= \frac{\omega \ (\tfrac{1}{2} \cdot p_{11}(y) + \tfrac{1}{2} p_{12}(y))}{(1-\omega) \ p_0(y) + \omega \ (\tfrac{1}{2} \cdot p_{11}(y) + \tfrac{1}{2} p_{12}(y))}. \\[6pt] \end{aligned}

As you can see, this significantly simplifies the notation for the model, and it makes it a lot easier to see the distributions at play. I recommend you proceed with simpler notation like this. It then becomes trivial to derive the Bayes' factor for the test, and any other associated probabilities of interest.

Following @Xi'an 's comment, I think I figured out the solution. let $w(\Theta \in \Lambda)$ be the prior distribution of $\Theta$. $P(y|\Theta \in \Lambda_0)=w(\Theta \in \Lambda_0).p_0(y)$ where $w(\Theta \in \Lambda_0) = 1$ since it is a simple hypothesis and there is only one distribution. Similarly, $P(y|\Theta \in \Lambda_1)=\sum_{i=1}^2 w(\Theta \in \Lambda_1).p_{1i}(y)$ where $\Theta$ is a Bernoulli random variable with $p=1/2$. Therefore, $P(y|\Theta \in \Lambda_1)=0.5p_{11}(y)+0.5p_{12}(y)$. Thanks for the help again!