$Z$-Test for two means exxamples

## Z-Test for two means examples

In this tutorial we will discuss some numerical examples on two sample z test for testing difference between the means.

## Z test Calculator for two means

The $Z$-test calculator for testing two population means makes it easy to calculate the test statistic, $Z$ critical value and the $p$-value given the sample information, level of significance and the type of alternative hypothesis (i.e. left-tailed, right-tailed or two-tailed.)

Z test Calculator for two means | |||
---|---|---|---|

Sample 1 | Sample 2 | ||

Sample Mean | |||

Standard Deviation | |||

Sample Size | |||

Level of Significance ($\alpha$) | |||

Tail | Left tailed Right tailed Two tailed |
||

Results |
|||

Standard Error of Diff. of Means: | |||

Test Statistics Z: | |||

Z-critical value(s): | |||

p-value: | |||

## How to use $z$-test calculator for testing two means?

Step 1 – Enter the sample mean for first sample $\overline{X}_1$ and second sample $\overline{X}_2$

Step 2 – Enter the population standard deviations for first population $\sigma_1$ and second population $\sigma_2$

Step 3 – Enter the sample size for first sample $n_1$ and second sample $n_2$

Step 4 – Enter the level of significance $\alpha$

Step 5 – Select the alternative hypothesis (left-tailed / right-tailed / two-tailed)

Step 6 – Click on "Calculate" button to get the result

## Z-Test for two means Example 1

An industrial engineer would like to determine whether there are more units produced on the night shift than on the day shift. Assume that the population standard deviation for the number of units produced on the day shift is 21 and is 28 on the night shift. A sample of 54 day shift workers showed that the mean number of units produced was 342. A sample of 60 night shift workers showed the mean number of units produced was 351. At the 0.05 significant level, is the average number of units produced on the night shift larger than the day shift?

#### Solution

Given that the sample size for day shift is $n_1 = 54$, and sample size for night shift is $n_2 = 60$. The average no. of units produced on the day shift is $\overline{x}_1= 342$, and the average no. of units produced on the night shift is $\overline{x}_2= 351$. The population standard deviation for the no. of units produced on the days shift is $\sigma_1 = 21$ and on the night shift is $\sigma_2 = 28$.

#### Step 1 State the hypothesis testing problem

We wish to test the hypothesis that the average number of units produced on the night shift ($\mu_2$) is larger than the day shift workers ($\mu_1$).

The hypothesis testing problem is

$H_0 : \mu_1 = \mu_2$ against $H_1 : \mu_1 < \mu_2$ ($\textit{left-tailed}$)

#### Step 2 Define test statistic

The test statistic for testing above hypothesis problem is

` $$ \begin{aligned} Z=\frac{(\overline{x}_1 -\overline{x}_1)-(\mu_1 -\mu_2)}{\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}. \end{aligned} $$ `

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

#### Step 3 Specify the level of significance

The significance level is $\alpha = 0.05$.

#### Step 4 Determine the critical value

As the alternative hypothesis is $\textit{left-tailed}$, the critical value of $Z$ $\text{is}$ $\text{-1.64}$.

The rejection region (i.e. critical region) is $\text{Z < -1.64}$.

#### Step 5 Computation

The test statistic for testing above hypothesis under the null hypothesis is

` $$ \begin{aligned} Z_{obs}&=\frac{(\overline{x}_1 -\overline{x}_1)-0}{\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}\\ &= \frac{342-351}{\sqrt{\frac{21^2}{54}+\frac{28^2}{60}}}\\ &= -1.953 \end{aligned} $$ `

#### Step 6 Decision (Traditional approach)

The rejection region (i.e. critical region) is $\text{Z < -1.64}$. The test statistic is $Z_{obs} =-1.953$ which falls $inside$ the critical region, we $\textit{reject}$ the null hypothesis.

OR

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

The test is $\text{left-tailed}$ test, so the p-value is the area to the $\text{left}$ of the test statistic ($Z_{obs}=-1.953$) is p-value = $0.0254$.

The p-value is $0.0254$ which is $\textit{less than}$ the significance level of $\alpha = 0.05$, we $\textit{reject}$ the null hypothesis.

#### Interpretation

There is enough evidence to support the alternative hypothesis.

The average number of units produced on the night shift is larger than number of units produced on the day shift.

## Z-Test for two means Example 2

In a life testing problem, the mean life of 38 cells of a company A, was found to be 30 hours. The mean life of 35 cells of company B, was found to be 25 hours. The population standard deviations are 10.48 hours and 9.48 hours for company A and company B respectively. On the basis of this information, can it be inferred that company A’s product is significantly better than company B’s product?

#### Solution

Given that the sample size $n_1 = 38$, $n_2 = 35$, sample mean $\overline{x}_1= 30$,

$\overline{x}_2= 25$, standard deviation $\sigma_1 = 10.48$ and $\sigma_2 = 9.48$.

#### Step 1 State the hypothesis testing problem

The hypothesis testing problem is

$H_0 : \mu_1 = \mu_2$ against $H_1 : \mu_1 > \mu_2$ ($\textit{right-tailed}$)

#### Step 2 Define test statistic

The test statistic is

` $$ \begin{aligned} Z=\frac{(\overline{x}_1 -\overline{x}_1)-(\mu_1 -\mu_2)}{\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}. \end{aligned} $$ `

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

#### Step 3 Specify the level of significance

The significance level is $\alpha = 0.05$.

#### Step 4 Determine the critical value

As the alternative hypothesis is $\textit{right-tailed}$, the critical value of $Z$ $\text{is}$ $\text{1.64}$.

The rejection region (i.e. critical region) is $\text{Z > 1.64}$.

#### Step 5 Computation

The test statistic for testing above hypothesis under the null hypothesis is

` $$ \begin{aligned} Z_{obs}&=\frac{(\overline{x}_1 -\overline{x}_1)-0}{\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}\\ &= \frac{30-25}{\sqrt{\frac{10.48^2}{38}+\frac{9.48^2}{35}}}\\ &= 2.14 \end{aligned} $$ `

#### Step 6 Decision (Traditional approach)

The rejection region (i.e. critical region) is $\text{Z > 1.64}$. The test statistic is $Z_{obs} =2.14$ which falls $inside$ the critical region, we $\textit{reject}$ the null hypothesis.

OR

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

The test is $\text{right-tailed}$ test, so the p-value is the area to the $\text{right}$ of the test statistic ($Z_{obs}=2.14$) is p-value = $0.0162$.

The p-value is $0.0162$ which is $\textit{less than}$ the significance level of $\alpha = 0.05$, we $\textit{reject}$ the null hypothesis.

#### Interpretation

There is enough evidence to support the alternative hypothesis at $0.05$ level of significance.

Company A’s product is significantly better than that of company B’s product.

## Z-Test for two means Example 3

Two kinds of thread are being compared for tensile strength. Fourty pieces of each type of thread are tested under similar conditions. Brand A has an average tensile strength of 81.6 kilograms with a standard deviation of 4.5 kilograms, while brand B had an average tensile strength of 84.5 kilograms with a standard deviation of 5.1 kilograms.

Is there a significant difference between the average tensile strength of the threads from two brands?

#### Solution

Given that the sample size $n_1 = 40$, $n_2 = 40$, sample mean $\overline{x}_1= 82.9$,

$\overline{x}_2= 84.5$, standard deviation $\sigma_1 = 5.4$ and $\sigma_2 = 5.8$.

#### Step 1 State the hypothesis testing problem

The hypothesis testing problem is

$H_0 : \mu_1 = \mu_2$ against $H_1 : \mu_1 \neq \mu_2$ ($\textit{two-tailed}$)

#### Step 2 Define test statistic

The test statistic is

` $$ \begin{aligned} Z=\frac{(\overline{x}_1 -\overline{x}_1)-(\mu_1 -\mu_2)}{\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}. \end{aligned} $$ `

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

#### Step 3 Specify the level of significance

The significance level is $\alpha = 0.05$.

#### Step 4 Determine the critical value

As the alternative hypothesis is $\textit{two-tailed}$, the critical value of $Z$ $\text{are}$ $\text{-1.96 and 1.96}$.

The rejection region (i.e. critical region) is $\text{Z < -1.96 or Z > 1.96}$.

#### Step 5 Computation

The test statistic for testing above hypothesis under the null hypothesis is

` $$ \begin{aligned} Z_{obs}&=\frac{(\overline{x}_1 -\overline{x}_1)-0}{\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}\\ &= \frac{82.9-84.5}{\sqrt{\frac{5.4^2}{40}+\frac{5.8^2}{40}}}\\ &= -1.277 \end{aligned} $$ `

#### Step 6 Decision (Traditional approach)

The rejection region (i.e. critical region) is $\text{Z < -1.96 or Z > 1.96}$. The test statistic is $Z_{obs} =-1.277$ which falls $outside$ the critical region, we $\textit{fail to reject}$ the null hypothesis.

OR

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

The test is $\text{two-tailed}$ test, so the p-value is the area to the $\text{extreme}$ of the test statistic ($Z_{obs}=-1.277$) is p-value = $0.2016$.

The p-value is $0.2016$ which is $\textit{greater than}$ the significance level of $\alpha = 0.05$, we $\textit{fail to reject}$ the null hypothesis.

#### Interpretation

There is no significant difference between the average tensile strength of the threads from two brands.

## Endnote

In this tutorial, you learned the about how to solve numerical examples on $Z$-test for testing two population means. You also learned about the step by step procedure to apply $Z$-test for testing two population means and how to use $Z$-test calculator for testing two population means to get the value of test statistic, p-value, and z-critical value.

To learn more about other hypothesis testing problems, hypothesis testing calculators and step by step procedure, please refer to the following tutorials:

- Z-test for two means
- Hypothesis Testing
- Statistics Calculators
- Z Test Calculator for mean with examples

Let me know in the comments if you have any questions on **$Z$-test calculator for two means with examples** and your thought on this article.