Given:
- $\langle x_n \rangle_{n=1}^N$ is a realization of a random sample $\langle X_n \rangle_{n=1}^N$ of a normally distributed random variable $X$
- Null hypothesis, $H_0$: $E[X] = 0$ and var$(X)= 1$
- Test statistic, $T = \frac{1}{N} \sum_{n=1}^N X_n$
- The rejection region is the closed interval $[-r,r]$, where $r$ is a parameter.
Determine
- r such that the probability of a type-1 error, i.e. rejecting $H_0$ when $H_0$ is true, is $0.05$.
Attempt:
Assume that $H_0$ is true, then the probability of rejecting $H_0$ satisfies \begin{align} 0.05 &= P (T\notin [-r,r]) \\ &=1 - P(T\in [-r,r]) \\ &=1- \int_{-r}^r\frac{1}{\sqrt{2\pi}}\text{exp}\left(-\frac{x^2}{2}\right)\text{d}x\\ &=1 - \frac{1}{2}\left(\text{erf}\left(\frac{r}{\sqrt{2}}\right)-\text{erf}\left(\frac{-r}{\sqrt{2}}\right)\right) \end{align}
How do I find $r$?
Under $H_0$, the distribution of $T$ is not standard normal. It is normal with zero mean and variance $$\text{Var}_{H_0}(T)\;\buildrel{\text{indep.}} \over = \;\frac{1}{N^2}\sum_{n=1}^N \text{Var}_{H_0}(X_n) = \dfrac{N}{N^2} = \dfrac1N.$$ So $\sqrt{N}T$ is a standard normal r.v. Therefore \begin{align} 0.05 &= P (T\not\in [-r,r]) \\ &=1 - P(T\in [-r,r]) \\ &=1 - P\Bigl(\sqrt{N\mathstrut}T\in \left[-\sqrt{N\mathstrut}r,\;\sqrt{N\mathstrut}r\right]\Bigr) \\ &=1- \Bigl(\Phi\left(\sqrt{N\mathstrut}r\right) - \Phi\left(-\sqrt{N\mathstrut}r\right)\Bigr). \end{align} Here $\Phi(x)=\frac{1}{\sqrt{2\pi}}\int\limits_{-\infty}^x e^{-t^2/2}\,dt$ is the cdf of standard normal distribution. Next use properties of $\Phi(x)$: $\Phi(x)=1-\Phi(-x)$ and replace r.h.s. of the above equality by $$ 0.05 = 2\Phi\left(-\sqrt{N\mathstrut}r\right), \qquad \Phi\left(-\sqrt{N\mathstrut}r\right) = 0.025. $$ Then use tables or some computer tools to find argument $-\sqrt{N\mathstrut}r$ and then $r$.