# What should be the Bayes factor while testing a simple null against a composite alternative?

Suppose $$X_1,X_2,\ldots,X_n$$ are i.i.d $$\text{Poisson}(\theta)$$ where $$\theta$$ has a Gamma prior. The testing problem is $$H_0:\theta=\theta_0$$ against $$H_1:\theta\ne \theta_0$$. I am trying to find the Bayes factor in favour of $$H_1$$.

Let $$\Theta_i$$ be the parameter space under $$H_i$$ and $$\Pi(\Theta_i)=\int_{\Theta_i}\pi(\theta)\,d\theta$$ where $$\pi$$ is the prior density, $$i=0,1$$. Similarly, $$\Pi(\Theta_i\mid \boldsymbol x)=\int_{\Theta_i}\pi(\theta\mid \boldsymbol x)\,d\theta$$ where $$\pi(\theta\mid \boldsymbol x)$$ is the posterior density.

My definition of Bayes factor in favour of $$H_1$$ is $$B=\frac{\text{Posterior odds}}{\text{Prior odds}}=\frac{\Pi(\Theta_1\mid \boldsymbol x)/\Pi(\Theta_0\mid \boldsymbol x)}{\Pi(\Theta_1)/\Pi(\Theta_0)}=\frac{\Pi(\Theta_1\mid \boldsymbol x)/\Pi(\Theta_1)}{\Pi(\Theta_0\mid \boldsymbol x)/\Pi(\Theta_0)}$$

For simple null against simple alternative, say $$H_0:\theta=\theta_0$$ vs $$H_1':\theta=\theta_1(\ne \theta_0)$$, Bayes factor is the likelihood ratio:

$$B=\frac{\pi(\theta_1\mid \boldsymbol x)/\pi(\theta_1)}{\pi(\theta_0\mid \boldsymbol x)/\pi(\theta_0)}=\frac{f(\boldsymbol x\mid \theta_1)}{f(\boldsymbol x\mid \theta_0)}$$

But how to use this definition for simple versus composite alternative as I have in the problem above?

Do I have to use a mixture prior for $$\theta$$ like $$\pi(\theta)=p\delta_{\theta_0}+(1-p)g(\theta)\,,$$ where $$\delta_{\theta_0}$$ denotes a degenerate distribution at $$\theta_0$$ and $$g(\cdot)$$ is the pdf of a Gamma distribution on $$\Theta-\{\theta_0\}$$? If this is the case, should the Bayes factor be modified as

$$B=\frac{\Pi(\Theta_1\mid \boldsymbol x)/\Pi(\Theta_1)}{\pi(\theta_0\mid \boldsymbol x)/\pi(\theta_0)}=\frac{\Pi(\Theta_1\mid \boldsymbol x)/\Pi(\Theta_1)}{f(\boldsymbol x\mid \theta_0)}\,\,?$$

I guess the posterior would also be a mixed distribution if I go down this road.

When considering a point null hypothesis such as $$\text{H}_0: \theta=\theta_0$$, the prior $$\pi$$ (if at all available before considering this null hypothesis) need be modified to incorporate a point mass at $$\theta_0$$. Otherwise, there is no need for data to reach a decision: $$\text{H}_0$$ is a priori and a posteriori impossible. This was made quite clear in Jeffreys' 1939 Theory of Probability.
Using the (mixture) prior with the point mass at $$\theta_0$$ $$\pi^\prime(\theta)=p\delta_{\theta_0}+(1-p)\pi(\theta)$$ means that the null hypothesis is a priori possible, with a prior probability of $$\Pi^\prime(\Theta_0) = \Pi^\prime(\{\theta_0\}) = p$$ The Bayes factor then writes as $$\dfrac{\Pi^\prime(\Theta_1\mid \boldsymbol x)/\Pi^\prime(\Theta_1)}{\Pi^\prime(\Theta_0\mid \boldsymbol x)/\Pi^\prime(\Theta_0)} = \dfrac{\Pi^\prime(\Theta_1\mid \boldsymbol x)/(1-p)} {\Pi^\prime(\Theta_0\mid \boldsymbol x)/p} = \dfrac{\int_0^\infty f(x|\theta)\pi(\theta)\,\text d\theta}{f(x|\theta_0)}$$ and the posterior is indeed a mixture of a Dirac mass at $$\theta_0$$ and of a Gamma (continuous) distribution.