This question already has an answer here:

Suppose we have that $X_1, \ldots, X_n \sim N(\mu, \sigma^2)$ where $\sigma^2$ is known. If we wanted to test the hypothesis of:

$$ H_0: \mu = \mu_0 \ \ \text{and} \ \ H_1: \mu \neq \mu_0 $$

a lot of books just jump directly to using a z-score based test statistic of:

$$ Z = \frac{\bar{X}-\mu}{\sigma/\sqrt{n}} \sim N(0,1) $$

However, I do not understand why or how they jump to this statistic aside from the fact it appears the normal distribution is easy to calculate from.

My question is, my understanding is that formally, we can choose any test statistic $T(X)$ such that:

$$ P(T(X) \in R\mid H_0) = \alpha $$

where $R$ is a rejection region to be found and $\alpha$ the significance level.

I am wondering how one can formally derive the $Z$ score approach above? Thanks.


marked as duplicate by kjetil b halvorsen, Michael Chernick, COOLSerdash, Peter Flom Apr 2 '18 at 12:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Among all the tests of level $\alpha$, a natural optimality criterion is the notion of being uniformly most powerful (UMP) - the test maximizes the power against all alternatives in $H_1$.

In the case of the one-sided alternative $H_1:\mu>\mu_0$ (or $H_1:\mu<\mu_0$), the z-test is UMP, which is essentially a consequence of the Neyman-Pearson Lemma.

Unfortunately, for the two-sided alternative $H_1:\mu\neq \mu_0$, no UMP test exists (Example 2.4). However, if we restrict ourselves to considering only unbiased tests (we require power at least $\alpha$ against all alternatives), it can be shown that the z-test is uniformly most powerful among all unbiased tests (Example 2.6).

Testing statistical hypotheses, E. Lehmann, and J. Romano. Springer Texts in Statistics Springer, New York, Third edition, (2005)


Not the answer you're looking for? Browse other questions tagged or ask your own question.