# Z test for Mean

## One sample Z-test for mean

In this tutorial we will explain the six steps approach used in hypothesis testing to test hypothesis about the population mean when the population standard deviation is known.

## One Sample Z-Test For Population Mean

Let $X_1, X_2, \cdots, X_n$ be a random sample from a normal population with mean $\mu$ and known variance $\sigma^2$.
Let $\overline{x}=\frac{1}{n} \sum X_i$ be the sample mean.

## Assumptions

a. The population from which, the sample drawn is assumed as Normal distribution.

b. The population variance $\sigma^2$ is known.

## Step by Step Procedure

We wish to test the null hypothesis $H_0 : \mu = \mu_0$, where $\mu_0$ is the specified value of the
population mean. The standard error of sample mean is

 \begin{aligned} SE(\overline{x}) &=\frac{\sigma}{\sqrt{n}}. \end{aligned}

The steps in the hypothesis testing procedure are as follows:

#### Step 1 State the hypothesis testing problem

The hypothesis testing problem can be structured in any one of the three situations as follows:

Situation Hypothesis Testing Problem
Situation A: $H_0: \mu=\mu_0$ against $H_a : \mu < \mu_0$ (Left-tailed)
Situation B: $H_0: \mu=\mu_0$ against $H_a : \mu > \mu_0$ (Right-tailed)
Situation C: $H_0: \mu=\mu_0$ against $H_a : \mu \neq \mu_0$ (Two-tailed)

#### Step 2 Define the test statistic

The test statistic for testing above hypothesis is

 \begin{aligned} Z &= \frac{\overline{x}-\mu}{SE(\overline{x})}\\ & = \frac{\overline{x}-\mu_0}{\sigma/\sqrt{n}} \end{aligned}

The test statistic $Z$ follows standard normal distribution $N(0,1)$.

#### Step 4 Determine the critical values

For the specified value of $\alpha$ determine the critical region depending upon the alternative hypothesis.

• For left-tailed alternative hypothesis: Find the $Z$-critical value using

 \begin{aligned} P(Z<-Z_\alpha) &= \alpha. \end{aligned}

• For two-tailed alternative hypothesis: $Z_{\alpha/2}$.

 $$P(Z<-Z_{\alpha/2} \text{ or } Z> Z_{\alpha/2}) = \alpha.$$

• For right-tailed alternative hypothesis: $Z_\alpha$.

 \begin{aligned} P(Z>Z_\alpha) & = \alpha. \end{aligned}

#### Step 5 Computation

Compute the test statistic under the null hypothesis $H_0$ using equation

 \begin{aligned} Z_{obs} &= \frac{\overline{x}-\mu_0}{\sigma/\sqrt{n}} \end{aligned}

#### Step 6 Decision (Traditional Approach)

Based on the critical values.

• For left-tailed alternative hypothesis: Reject $H_0$ if $Z_{obs}\leq -Z_\alpha$.
• For right-tailed alternative hypothesis: Reject $H_0$ if $Z_{obs}\geq Z_\alpha$.
• For two-tailed alternative hypothesis: Reject $H_0$ if $|Z_{obs}|\geq Z_{\alpha/2}$.

OR

#### Step 6 Decision ($p$-value Approach)

It is based on the $p$-value.

Alternative Hypothesis Type of Hypothesis $p$-value
$H_a: \mu<\mu_0$ Left-tailed $p$-value $= P(Z\leq Z_{obs})$
$H_a: \mu>\mu_0$ Right-tailed $p$-value $= P(Z\geq Z_{obs})$
$H_a: \mu\neq \mu_0$ Two-tailed $p$-value $= 2P(Z\geq abs(Z_{obs}))$

If $p$-value is less than $\alpha$, then reject the null hypothesis $H_0$ at $\alpha$ level of significance, otherwise fail to reject $H_0$ at $\alpha$ level of significance.

## Endnote

In this tutorial, you learned the $Z$-test for testing population mean and the assumptions for $Z$-test for testing population mean. You also learned about the step by step procedure to apply $Z$-test for testing population mean.

Let me know in the comments if you have any questions on $Z$-test for population mean and your thought on this article.