# 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 ?

• Yes, the rule you chose is equivalent to deciding based of which side of $\lambda_0$ the median of the posterior is on, and it seems like you've computed the posterior correctly. Assuming this is the rule you want, I don't know that there's anything you can do further until it's actually time to put some numbers in. There's no closed form expression for that median. – spaceisdarkgreen Jan 13 at 6:42