# On a Bayesian hypothesis testing

Let $$X_1,...,X_n$$ be a random sample and $$\lambda >0$$ be a parameter, with $$X_i |\lambda \sim Poisson (\lambda)$$ and $$\lambda \sim Gamma(\alpha, \beta) (\lambda)=\dfrac {1}{\Gamma(\alpha) \beta^\alpha} \lambda ^{\alpha-1} e^{-\lambda / \beta}$$.

I want to find a Bayesian test of hypothesis for $$H_0 : \lambda \le \lambda_0$$ against $$H_1: \lambda > \lambda_1$$ .

Now I know that a simple rule is that accept $$H_0 :$$ If $$P(\lambda \le \lambda_0|Y=y) \ge P(\lambda > \lambda_0 | Y=y)$$ .

Now $$Y=\sum_{i=1}^n X_i$$ is a sufficient statistics , and the posterior pdf of $$\lambda |Y=y$$ is a constant (depending on $$y$$ but independent of $$\lambda$$ ) times $$\lambda ^{y+\alpha -1} e^{-n\lambda -\frac {\lambda}{ \beta}}$$ , so $$\lambda|Y=y \sim Gamma (y+\alpha, \dfrac {\beta}{n\beta+1}), so$$ $$P(\lambda \le \lambda_0|Y=y) \ge P(\lambda > \lambda_0 | Y=y)$$ is equivalent to saying

$$\dfrac {1}{\Gamma (y+\alpha ) } \gamma (y+\alpha,n\lambda_0 +\frac {\lambda_0}{ \beta})\ge 1-\dfrac {1}{\Gamma (y+\alpha ) } \gamma (y+\alpha,n\lambda_0 +\frac {\lambda_0}{ \beta})$$, so

$$\lambda_0 \ge$$ median of $$Gamma (y+\alpha, \dfrac {\beta}{n\beta+1})$$ .

But I don't know what to do further. Am I even on the right track ?

• Given your simple rule, why do you think you have any more to do at all? It would likely be better to report the probability that $\lambda \leq \lambda_0$ rather than just a 0-1 decision, but other than that... – jbowman yesterday