9.1: z-Test for the Difference Between Two Means
- Page ID
- 46186
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)
- Understand how to perform hypothesis testing for the difference between two means using z-values.
- Recognize that this method is appropriate when both population standard deviations are known and samples are large, or populations are normally distributed.
- Determine whether there is a significant difference between the two population means.
- Understand that the method assumes independent samples.
- Use the standard normal distribution (z-distribution) to compare the test statistics and make decisions.
There are many situations where two means will be compared. For example, assume the average age of students who attend community colleges in California is to be compared to the average age of students who attend community colleges in Florida. The two populations must be independent of each other. This means that there is no data value common to both populations. Random samples of each population can be collected.
Moreover, \(\mu_1\) represents the mean of population#1 and \(\mu_2\) represents the mean of population#2. Moreover, \(\bar{X}_1\) is the mean of sample#1 and \(\bar{X}_2\) is the mean of sample#2. Using the central limit theorem, multiple samples involving the difference of the two sample means (\(\bar{X}_1\)-\(\bar{X}_2\)) can be determined. This will result in a normally shaped distribution in which the mean of the distribution of the differences of the sample means equals zero. To apply the z-test, the following conditions must be true.
- Both samples must be random.
- The population standard deviations must be known.
- Both samples must have sample sizes greater than or equal to 30, or both populations must be normal.
z-test Process for Two Means
- State the hypothesis, identify the claim, and determine the null and alternative hypotheses. The three possibilities are presented below. One of these statements will be the claim. Draw the standard normal distribution and shade in the proper tail area. The total tail area equals the given \(\alpha\).
| Two-Tailed Test | Right-Tailed Test | Left-Tailed Test |
|---|---|---|
|
\(H_0: \mu_1 = \mu_2\) \(H_1: \mu_1 \ne \mu_2\) |
\(H_0: \mu_1 = \mu_2\) \(H_1: \mu_1 > \mu_2\) |
\(H_0: \mu_1 = \mu_2\) \(H_1: \mu_1 < \mu_2\) |
- Look up the critical values in the table. These values separate the critical regions from the non-critical regions.
- Compute the test point using the formula below.
\(z=\dfrac{(\bar{X}_1-\bar{X}_2)-(\mu_1-\mu_2)}{\sqrt{\dfrac{\sigma_{1}^{2}}{n_1}+\dfrac{\sigma_2^2}{n_2}}}\)
Note: Since the test is for \(H_0\), the difference \(\mu_1-\mu_2=0\).
- Make the decision to reject or not reject the null hypothesis.
- Summarize the results.
Examples
An educational researcher claims that there is a difference in the average ages of community college students who attend California and Arizona. She collects random samples from both populations and lists the results in the table below. Test the researcher's claim using \(\alpha\) = 0.05. The data is measured in years.
| California Community Colleges | Arizona Community Colleges |
|---|---|
| \(\bar{X}_1=28\) | \(\bar{X}_2=25\) |
| \(\sigma_1=4.5\) | \(\sigma_2=3.2\) |
| \(n_1=44\) | \(n_2=40\) |
Solution
- State the Hypothesis and Identify the Claim: The word "difference" translates to "\(\ne\)," which leads to the following hypotheses and claim.
\(H_0: \mu_1 = \mu_2\)
\(H_1: \mu_1 \ne \mu_2\) Claim
- Find the Critical Value: Draw a standard normal distribution and look up the critical values in the table. They are \(\pm 1.96\).
- Compute the Test Statistic: Use the given sample data and the test point formula to compute the value. Recall that \(\mu_1-\mu_2=0\).
\(z=\dfrac{\left(28-25\right)-0}{\sqrt{\dfrac{4.5^2}{45}+\dfrac{3.2^2}{40}}}=3.57\)
- Make the Decision: The result of the z-test is to "reject \(H_0\)" as the test point falls in the critical region.
- Summarize the Results: Write out the summary statement. This summary statement is to "support the claim that there is a difference in ages."
A dietitian compares two types of diets (diet A and diet B) to determine whether one leads to more weight loss on average. He claims that diet A's average weight loss is greater than diet B's average weight loss. The data (collected in pounds) is summarized in the table below. Test the claim using \(\alpha\) = 0.05.
| Diet A | Diet B |
|---|---|
| \(\bar{X}_1=15\) | \(\bar{X}_2=13.3\) |
| \(\sigma_1=2.3\) | \(\sigma_2=2.7\) |
| \(n_1=35\) | \(n_2=48\) |
Solution
- State the Hypothesis and Identify the Claim: The word "greater than" translates to ">," which lead to the following hypotheses and claim.
\(H_0: \mu_1 = \mu_2\)
\(H_1: \mu_1 > \mu_2\) Claim
- Find the Critical Value: Draw a standard normal distribution, shade in the right tail, and look up the critical values in the table. It is 1.65.
- Compute the Test Statistic: Use the given sample data and the test point formula, compute the value. Recall that \(\mu_1-\mu_2=0\).
\(z=\dfrac{\left(15-13.3\right)-0}{\sqrt{\dfrac{2.3^2}{35}+\dfrac{2.7^2}{48}}}=3.09\)
- Make the Decision: The result of the z-test is to "reject \(H_0\)" as the test point falls in the critical region.
- Summarize the Results: Write out the summary statement. This summary statement is to "support the claim that the average weight loss for diet A is greater than the average weight loss for diet B."
Technology such as the TI-84+ calculator can be used to compute the test point for a z-test for two means. This process will be used in the next example.
A researcher is testing the claim that there is a difference in the average cost spent by a family of four who attend the National Basketball Association (NBA) and National Hockey League (NHL) games. Data is collected and summarized in the table below. The data is units of U.S. dollars. Test the claim using \(\alpha\) = 0.01.
| NBA Game Costs for Family of Four | NHL Game Costs for Family of Four |
|---|---|
| \(\bar{X}_1=468\) | \(\bar{X}_2=448\) |
| \(\sigma_1=45.69\) | \(\sigma_2=33.98\) |
| \(n_1=30\) | \(n_2=40\) |
Table \(\PageIndex{4}\): Difference in Costs at Sporting Events
Solution
- State the Hypothesis and Identify the Claim: The word "difference" translates to "\(\ne\)," which leads to the following hypotheses and claim.
\(H_0: \mu_1 = \mu_2\)
\(H_1: \mu_1 \ne \mu_2\) Claim
- Find the Critical Value: Draw a standard normal distribution, shade in two tails, and look up the critical values in the table. They are \(\pm 2.58\).
- Compute the Test Statistic: Use a TI-84+ calculator to compute the test statistic value. Follow the steps below.
a) Press the [STAT] button, use the right arrow to select [TESTS], and then select [3: 2-SampZTest].
b) Select [STATS], and then enter the data from the table into the calculator. The input should look as it does in the image below. Finally, select [Calculate] and press [Enter].
c) The output on the calculator screen is presented in the image below. Note the test point is 2.02 (rounded to two place values) and the p-value is 0.0438 (rounded to four decimal place values).
- Make the Decision: The result of the z-test is "do not reject \(H_0\)" as the test point does not fall in the critical region. Also, the p-value = 0.0438 > \(\alpha = 0.01\)
- Summarize the Results: Write out the summary statement. This summary statement is written as "do not support the claim that there is an average difference in costs at NBA and NHL games for a family of four."
Author
"9.1: z-Test for the Difference Between Two Means" by Alfie Swan is licensed under CC BY 4.0


