##### Using the $C$% confidence interval for $\mu$ to perform right sided one sample $z$ test: full explanation

If $\mu_0$ is not in the $C$% confidence interval and the sample mean is larger than $\mu_0$ (as expected), the sample mean is significantly larger than $\mu_0$ at significance level $\alpha = \frac{1 \, - \, C/100}{2}$ If $\mu_0$ is not in the $C$% confidence interval and the sample mean is larger than $\mu_0$, the sample mean is significantly larger than $\mu_0$ at significance level $\alpha = \frac{1 \, - \, C/100}{2}$. In order to understand why, we have to be aware of the following three points, which are illustrated in the figure above: The lower bound of the $C$% confidence interval for $\mu$ is $\bar{y} - z^* \times \sigma/\sqrt{N}$, the upper bound is $\bar{y} + z^* \times \sigma/\sqrt{N}$. That is, we subtract $z^* \times \sigma/\sqrt{N}$ from the sample mean, and we add $z^* \times \sigma/\sqrt{N}$ to the sample mean. Here: $\sigma/\sqrt{N}$ is the standard deviation of $\bar{y}$ the critical value $z^*$ is the value under the $z$ distribution with area $C / 100$ between $-z^*$ and $z^*$, and therefore area $\frac{1\,-\,C/100}{2}$ to the right of $z^*$. In the figure above, the red dots represent sample means, the blue arrows represent the distance $z^* \times \sigma/\sqrt{N}$. If we set the significance level $\alpha$ at $\frac{1 \, - \, C/100}{2}$, the critical value $z^*$ used for the significance test is the value under the $z$ distribution with area $\alpha = \frac{1\,-\,C/100}{2}$ to the right of $z^*$. This is the same critical value $z^*$ as the $z^*$ used for the $C$% confidence interval. We reject the null hypothesis at $\alpha = \frac{1\,-\,C/100}{2}$ if the $z$ value $z = \frac{\bar{y} - \mu_0}{\sigma/\sqrt{N}}$ is at least as large as $z^*$. This means that we reject the null hypothesis at $\alpha = \frac{1\,-\,C/100}{2}$ if sample mean $\bar{y}$ is at least $z^* \times \sigma/\sqrt{N}$ above $\mu_0$. In the figure above, the rejection region for $\bar{y}$ is represented by the green area. If $\mu_0$ is not in the $C$% confidence interval [$\bar{y} - z^* \times \sigma/\sqrt{N} \,;\, \bar{y} + z^* \times \sigma/\sqrt{N}$] and the sample mean $\bar{y}$ is larger than $\mu_0$, then $\bar{y}$ must be at least $z^* \times \sigma/\sqrt{N}$ above $\mu_0$. In the figure above, the first confidence interval does not contain $\mu_0$ and the sample mean is larger than $\mu_0$, so the sample mean must be at least $z^* \times \sigma/\sqrt{N}$ above $\mu_0$. The second confidence interval does contain $\mu_0$, so the sample mean must be less than $z^* \times \sigma/\sqrt{N}$ above $\mu_0$. In sum, if $\mu_0$ is not in the $C$% confidence interval [$\bar{y} - z^* \times \sigma/\sqrt{N} \,;\, \bar{y} + z^* \times \sigma/\sqrt{N}$] and the the sample mean is larger than $\mu_0$, we know that the the sample mean is significantly larger than $\mu_0$ at significance level $\alpha = \frac{1 \, - \, C/100}{2}$.