# Identifying sample size in hypothesis testing question

I have the following question: Find the best size $$\alpha$$ test of $$H_0:\theta=\theta_0$$ vs $$H_1:\theta =\theta_1$$, with $$\theta_1>\theta_0$$, write down the expression for the power function when $$X_1,\dots,X_n$$ are IID exponential random variables, with parameter $$\theta$$.

Use the $$\chi^2$$ tables to find the least sample size which will allow us to test $$H_0:\theta=1$$ against $$H_1:\theta=3$$ with $$\alpha=5\%$$ and $$\beta\leq 10\%$$. Describe the appropiate critical region numerically.

I have managed to find the best test size in the following way:

First of all, finding the likelihood ratio:

$$\begin{gather}\frac{f_1(x|\theta_1)}{f_0(x|\theta_0)}= \left(\frac{\theta_1}{\theta_0}\right)^n \cdot e^{-(\sum x_i)(\theta_1-\theta_0)} \end{gather}$$.

Then, for the sufficient statistic $$T = \sum X_i$$, we condition that the likelihood ratio be bigger than $$k(\alpha)$$. Computing the inequality, we get that we need to have $$T, where $$c_s=\frac{n(ln\theta_1 - ln\theta_0)-lnk(\alpha)}{\theta_1-\theta_0}$$.

Now, we know further that $$T\sim Gamma(n,\theta)$$. Hence, by Neyman-Pearson Lemma we have that :

$$\begin{gather}\alpha = \int_{c_s}^{\infty}\frac{1}{\Gamma(n)}t^{n-1}e^{-t}dt \end{gather}$$

We can compute $$c_s$$. However, I do not know what to do for the next part.

• Rejection region is $T<c$ but not sure how you got the $c$. It is found subject to the size restriction $P_{\theta=\theta_0}(T<c)=\alpha$, where you get $c$ in terms of chi-square quantiles. Note that if $X_i$s are iid Exp with mean $1/\theta$ then $2\theta X_i$s are iid $\chi^2_2$, so that $2\theta T\sim \chi^2_{2n}$. The power function is given by $P_{\theta}(T<c)$. Jul 1 '20 at 6:48

As you calculated, we Reject $$\mathcal{H}_0$$ if $$\sum_i X_i

where $$c^*$$ is calculated by

$$\int_0^{c^*}\frac{\theta_0^n}{\Gamma(n)}t^{n-1}e^{-\theta_0 t}dt=\alpha$$

Then the power of the test is, by definition,

$$\mathbb{P}[\text{Reject }\mathcal{H}_0|\mathcal{H}_1]$$ that is

$$\gamma=\int_0^{c^*}\frac{\theta_1^n}{\Gamma(n)}t^{n-1}e^{-\theta_1 t}dt$$

Now, considering the second part, we have the following system to verify

$$\begin{cases} \mathcal{H}_0: \theta=1 \\ \mathcal{H}_1: \theta=3 \end{cases}$$

We know that $$\sum_i X_i\sim Gamma(n;\theta)$$ that means $$2\theta\sum_i X_i\sim \chi_{(2n)}^2$$

Considering the text request, we must search the minimum $$n$$ such that $$\alpha=5\%$$ with a power $$\gamma=1-\beta \geq 90\%$$

In other words we are looking for the following condition to be satisfied:

$$\begin{cases} \mathbb{P}[2\sum_i X_i 0.90 \end{cases}$$

By simply scrolling the $$\chi^2$$ table, we have to find the first row where the 90° percentile is more than 3 times the 5° percentile. This row is the one corresponding to the 16 degrees of freedom:

$$F_{(16)}^{-1}(0.05)=7.96$$

$$F_{(16)}^{-1}(0.90)=23.50$$

and $$7.96\times3=23.88$$

So the minimum sample size is 8 which gets a test with $$\alpha=5\%$$ and a power $$\gamma \approx 91\%$$