Suppose that $[X∣p]∼Bin(15,p)$, and the goal is to test if $H_0:p∼Unif([0,0.5])$ and $H_a:p∼Unif((0.5,1])$. Suppose $X=9$, Find the evidence for $H_0, H_a$ and the Bayes factor.
In this case, the p is uniform, so is it correct to say that p for $H_0$ is $0.25$ and p for $H_a$ is $0.75$?
If so, is this correct for calculating $H_0$: $P(X=9|H_0)$ = $15\choose9$ $(.25)^{15}$
In Bayesian model comparison, the Bayes factor is given by the marginal likelihoods of the two hypotheses' ratio.
The marginal likelihood for hypothesis $H_0$ is $$\mathbb P(X=9\mid H_0) = \int_{p\in[0,0.5]}\mathbb P(X=9\mid p,H_0)\cdot f_0(p)\ dp$$ Where $f_0$ is the density function of $p$ under hypothesis $H_0$ (i.e. $f_0(x) = 2\ \forall x$) and $\mathbb P(X=9\mid p,H_0) = {15\choose 9}p^9(1-p)^6$. Therefore $$\mathbb P(X=9\mid H_0) = \int_{p\in[0,0.5]} {15\choose 9}p^9(1-p)^6\cdot2\ dp \approx 0.028 $$ Similarly, $$\mathbb P(X=9\mid H_a) = \int_{p\in[0.5,1]} {15\choose 9}p^9(1-p)^6\cdot2\ dp \approx 0.097 $$ Finally, the Bayes factor is given by $$ K = \frac{P(X=9\mid H_0)}{P(X=9\mid H_a)} \approx 0.289$$ Which seems to suggest that $H_a$ is slightly more likely than $H_0$