Likelihood ratio of exponential distribution Setting up a likelihood ratio test where for the exponential distribution, with pdf: 
$$f(x;\lambda)=\begin{cases}\lambda e^{-\lambda x}&,\,x\ge0\\0&,\,x<0\end{cases}$$
And we are looking to test: 
$$H_0:\lambda=\lambda_0 \quad\text{ against }\quad H_1:\lambda\ne \lambda_0$$
Now, when $H_1$ is true we need to maximise its likelihood, so I note that in that case the parameter $\lambda$ would merely be the maximum likelihood estimator, in this case, the sample mean. 
Some algebra yields a likelihood ratio of: 
$$\left(\frac{\frac{1}{n}\sum_{i=1}^n X_i}{\lambda_0}\right)^n \exp\left(\frac{\lambda_0-n\sum_{i=1}^nX_i}{n\lambda_0}\right)$$
And if I let the statistic: 
$$Y=\sum_{i=1}^n X_i$$
I can rewrite the above equation as: 
$$\left(\frac{\frac{1}{n}Y}{\lambda_0}\right)^n \exp\left(\frac{\lambda_0-nY}{n\lambda_0}\right)$$
When the null hypothesis is true, what would be the distribution of $Y$?
And if I were to be given values of $n$ and $\lambda_0$ (e.g. $n=50$ and $\lambda_0=3/2$ , how would I go about determining a test based on $Y$ at the $1\%$ level of significance? 
 A: Assuming you are working with a sample of size $n$, the likelihood function given the sample $(x_1,\ldots,x_n)$ is of the form
$$L(\lambda)=\lambda^n\exp\left(-\lambda\sum_{i=1}^n x_i\right)\mathbf1_{x_1,\ldots,x_n>0}\quad,\,\lambda>0$$
The LR test criterion for testing $H_0:\lambda=\lambda_0$ against $H_1:\lambda\ne \lambda_0$ is given by
$$\Lambda(x_1,\ldots,x_n)=\frac{\sup\limits_{\lambda=\lambda_0}L(\lambda)}{\sup\limits_{\lambda}L(\lambda)}=\frac{L(\lambda_0)}{L(\hat\lambda)}$$
, where $\hat\lambda$ is the unrestricted MLE of $\lambda$.
A routine calculation gives $$\hat\lambda=\frac{n}{\sum_{i=1}^n x_i}=\frac{1}{\bar x}$$
Then we have 
$$\Lambda(x_1,\ldots,x_n)=\lambda_0^n\,\bar x^n \exp(n(1-\lambda_0\bar x))=g(\bar x)\quad,\text{ say }$$
Now study the function $g$ to justify that $$g(\bar x)<c \iff \bar x<c_1\quad\text{ or }\quad \bar x>c_2$$
, for some constants $c_1,c_2$ determined from the level $\alpha$ restriction 
$$P_{H_0}(\overline X<c_1)+P_{H_0}(\overline X>c_2)\leqslant \alpha$$
You are given an exponential population with mean $1/\lambda$. So we can multiply each $X_i$ by a suitable scalar to make it an exponential distribution with mean $2$, or equivalently a chi-square distribution with $2$ degrees of freedom. Note the transformation
\begin{align}
X_i\stackrel{\text{ i.i.d }}{\sim}\text{Exp}(\lambda)&\implies 2\lambda X_i\stackrel{\text{ i.i.d }}{\sim}\chi^2_2
\\&\implies 2\lambda \sum_{i=1}^n X_i\sim \chi^2_{2n}
\end{align}
That is, we can find $c_1,c_2$ keeping in mind that under $H_0$, $$2n\lambda_0 \overline X\sim \chi^2_{2n}$$
We use this particular transformation to find the cutoff points $c_1,c_2$ in terms of the fractiles of some common distribution, in this case a chi-square distribution.
