# Rejection region of a z-test

Be $$\mathbf X:=(X_1,..,X_n)$$ a $$n$$-dimensional sample of Gaussian rvs with known population variance $$\sigma^2$$, but with unknown population mean $$\mu$$. I test the rejection of $$H_0$$ in favor of $$H_1$$:

$$H_0$$: $$\mu=\mu_0$$ vs. $$H_1$$: $$\mu=\mu_1$$. The values $$\mu_0$$ and $$\mu_1$$ don't matter for now.

I will indicate the sample mean with $$\bar X$$.

1. I compute the likelihood ratio $$LR$$ for a Gaussian sample to determine the rejection region: $$LR=\exp\left[\frac 1{2\sigma^2}\sum_{i=1}^n\left((X_i-\mu_0)^2-(X_i-\mu_1)^2\right)\right]$$
2. Set the rejection region $$\mathcal R:=\{(X_1,..,X_n):LR>\tilde c\}=\{(X_1,..,X_n):\bar X>c\}$$, with $$c:=\frac{\sigma^2}{n(\mu_1-\mu_0)}\log \tilde c+\frac{\mu_0+\mu_1}2$$, in example if $$\mu_0<\mu_1$$, or switching some signs otherwise.
3. Set a test level $$\alpha$$ to delimitate the rejection region (use that the sample is Gaussian): $$\mathbb P\left(\left.\bar X>c\right|\mu=\mu_0\right)=\alpha\Rightarrow c=\mu_0+\frac\sigma{\sqrt n}q_{1-\alpha},$$ where $$q_{1-\alpha}$$ is the quantile of the normal distribution of level $$1-\alpha$$.
4. Now I compute the p-value $$\pi_0$$ associated to these data with sample mean $$\bar X$$ as the lowest level $$\alpha$$ so that the data lie in the rejection region: $$\pi_0:=\inf\{\alpha:\bar X>c\}=1-\Phi\left[\frac{\sqrt n}\sigma\left(\bar X-\mu_0\right)\right].$$

After the corrections, I came up with almost an answer, but one question mark is still open to me:

Why is the rejection region independent from $$H_1$$?

## EDIT

Many computations were wrong, and now everything seems much more understandable, thanks to the answer below, that showed me with numbers what is under the hood.

I will illustrate this likelihood ratio test using specific numbers for the parameters. Then you can compare numerical results with your inequalities. I'll give you some guidance where to look in order to straighten out your main misconceptions.

For the known distribution values, let $$n = 16, \sigma = 15.$$ For the null and alternative hypotheses let $$\mu_0 = 100, \mu_1=110,$$ so that $$H_0: \mu = 100$$ and $$H_1: \mu = 100.$$ You have chosen $$\alpha = P(\mathrm{Rej}|H_0) = 0.1.$$

Under $$H_0$$ the distribution of the test statistic $$\bar X$$ is $$\mathsf{Norm}(\mu_0 = 100, \sigma=15/\sqrt{n} = 15/4 = 3.75).$$

It makes sense that you will reject $$H_0$$ for $$\bar X \ge C,$$ where the critical value is chosen in accordance with $$\alpha = 0.1.$$ Thus, from R, we have $$C = 104.8.$$ [Your Item 4 is not needed in order to find $$C.$$ Your Item 5 incorrectly states the criterion for rejection.]

qnorm(.9, 100, 3.75)
[1] 104.8058

mh="Distributions of Sample Mean Under Null (blue) and Alternative Hypotheses"
xl="Sample Mean"
curve(dnorm(x,100,3.75), 85, 125, ylim=c(0,.12),
lwd=2, col="blue", ylab="PDF", xlab=xl, main=mh)
abline(h=0, col="green2")
abline(v=104.8, col="orange2")


Perhaps a couple of additional computations in R will be useful as you go more deeply into testing a simple null hypothesis against a simple alternative (one value of $$\mu$$ specified for each).

If you collect data according to the scenario described here and obtain $$\bar X = 105.2,$$ then you will reject $$H_0$$ because $$\bar X > C = 104.8.$$ In that case, the P-value is the probability under $$H_0$$ of getting a value 'more extreme' (greater than or equal to) the observed $$105.2.$$ That is, $$P(\bar X \ge 105.2\,|\,H_0) = 1 - P(\bar X < 105.2) = 0.083 < 0.1 = \alpha,$$ computed in R as shown below. One rejects $$H_0$$ for P-values smaller than the significance level. By contrast, if you were to observe $$\bar X= 103.1,$$ you would not reject $$H_0$$ because $$\bar X < C$$ and because the corresponding P-value $$0.204 > 0.1 = \alpha.$$

1 - pnorm(105.2, 100, 3.75)
[1] 0.08277171
1 - pnorm(103.1, 100, 3.75)
[1] 0.204213


Also, the power of this likelihood ratio tests against the alternative value $$\mu=110$$ is $$P(\mathrm{Reject}|H_1) = P(\bar X > C\,|\,H_1) = 0.917.$$ (Notice that the R code uses $$\mu_1 = 110.)$$ The probability of a Type II Error is $$\beta = P(\mathrm{Fail\; to\; Rej}|H_1) = P(\bar X < C\,|\,H_1) = 0.083.$$

1 - pnorm(104.8, 110, 3.75)  # Uses ALTERNATIVE
[1] 0.9172283
pnorm(104.8, 110, 3.75)
[1] 0.08277171

• Hi, thank you for taking your time to go through all my question. Going through your question I found out I was committing some mistakes, and could obtain a reasonable rejection region, that depends wheter $\mu_1$ is larger or smaller than $\mu_0$, which is reasonable. However, your p-value and your rejection region seem to depend on $\mu_1$ also, while it doesn't happen for me. It sounds odd honestly .. – marco Jun 22 '20 at 12:52
• The effect of $\mu_1 > \mu_0$ is that $C > \mu_9$ so that you reject for "large" $\bar X.$ The exact value of $\mu_1$ becomes important when you compute power. – BruceET Jun 22 '20 at 17:33
• So please tell me if I understand the sense of a statistical test: the rejection region tells if data are rejecting $H_0$ regardless than $H_1$, so I might also have data within the rejection region of $H_1$, if treated as another null hypothesis. One might then set up different alternative hypotheses and select the one with higher power .. – marco Jun 22 '20 at 17:40
• Thank you! Now I see things way clearer. But, why should one try to make $\alpha=\beta$? I would just try to minimise one and maximise the other. – marco Jun 22 '20 at 18:14
• Ok, I see what you mean, consider that I usually indicate the power with $\beta$, and now that I check your answer I see what you mean. I never thought to balance the two .. – marco Jun 22 '20 at 18:45