Skip to main content
Statistics LibreTexts

9.2: t-Test for the Difference Between Two Means

  • Page ID
    46187
  • \( \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}\)
    Learning Objectives
    • Understand how to perform hypothesis testing for the difference between two means using t-values.
    • Recognize that this method is appropriate when population standard deviations are unknown and sample sizes are small.
    • Apply the test to compare two independent groups.
    • Use the t-distribution to account for variability in sample standard deviations.
    • Make decisions based on the comparison of the test statistic to critical t-values.

    A t-test for the difference between two means is used to determine whether there is a statistically significant difference between the means of two independent groups. The test compares the sample means while accounting for variability within each group. The null hypothesis assumes no difference between the means, while the alternative hypothesis suggests a difference exists. The test statistic is calculated using the sample means, standard deviations, and sample sizes and is then compared to a critical value from the t-distribution.

    Hypothesis Test for Independent t-Test (2-Sample t-Test)

    1. State the claim and determine the null and alternative hypotheses. Also, the number of tails for the test will be determined, and the tails will be shaded in the t-distribution.
    Types of Tests
    Two-Tailed Test Right-Tailed Test Left-Tailed Test

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 \ne \mu_2\)

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 > \mu_2\)

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 < \mu_2\)

    Table \(\PageIndex{1}\): Types of Test for Hypotheses Testing

    1. Look up the critical value in the table using degrees of freedom. The degrees of freedom is the minimum value between \(n_1-1\) and \(n_2-1\)
    2. If needed, compute the sample statistics - sample means and standard deviations.

    Sample Statistic:
    Calculate \(\overline{x}_{1}, \overline{x}_{2}, s_{1}, s_{2}, n_{1}, n_{2}\)

    1. Find the sample statistic, test statistic, and if needed the p-value


    \(t=\dfrac{(\bar{X}_1-\bar{X}_2)-(\mu_1-\mu_2)}{\sqrt{\dfrac{s_{1}^{2}}{n_1}+\dfrac{s_2^2}{n_2}}}\)

    Note: Since the test is for \(H_0\), the difference \(\mu_1-\mu_2=0\).

    1. Make a decision and summarize the results.
    Example \(\PageIndex{1}\) t-Test Using Traditional (Critical Value) Method

    A researcher claims that there is a difference in the average weight of an adult rhinoceros and an adult hippopotamus. The researcher collected data to test the claim and summarized the results in the table below. The data is measured in kilograms.Test the claim using using \(\alpha = 0.01\)

    Data Set
    Rhinoceros Hippopotamus
    \(\bar{X}_1=2300\) \(\bar{X}_2=1820\)
    \(s_1=225\) \(s_2=180.5\)
    \(n_1=10\) \(n_2=11\)

    Table \(\PageIndex{2}\): Summarized Data for the Weights of Adult Rhinoceroses and Hippopotamuses.

    Solution
    1. State the claim and determine the null and alternative hypotheses. The word "difference" translates to \(\ne\).

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 \ne \mu_2\) Claim

    The test has two tails.

    1. Determine the critical values.

    Calculate \(n_1-1 = 10-1\) = 9 and \(n_2-1 = 11-1\) = 10. The degrees of freedom is 9 as it is the minimum of the two values. Looking up the values in the table using d.f. = 9, two tails, and \(\alpha = 0.01\), the critical values are \(\pm\)3.250.

    1. Compute the test point.

    \(t=\dfrac{(2300-1820)-(0)}{\sqrt{\dfrac{225^{2}}{10}+\dfrac{180.5^2}{11}}}\) = 5.36

    1. Make a decision. For this problem, the decision is to "reject \(H_0\)" because the t-test point falls in the critical region
    The test point (5.36) falls into the critical region - reject the null hypothesis.

    Figure \(\PageIndex{1}\): The Test Point (5.36) Falls into the Critical Region - Reject H0.
    1. The summary statement is that "there is enough evidence to support that there is a difference in the weights of the two animals."
    Example \(\PageIndex{2}\) t-Test Using Traditional (Critical Value) Method

    A math instructor wishes to test a claim that the average score on exams taken by night students is greater than the average score on exams taken in the morning at the school where the instructor works. The instructor collects two random samples of exam scores from both populations. The data is listed in the table below Test the claim using \(\alpha = 0.05\).

    Data Set
    Evening Student Scores Morning Student Scores
    98 49
    80 78
    88 92
    85 60
    86 87
    88 61
    95 70
    86 71
    96 95
    75 85

    Table \(\PageIndex{3}\): Data for the Evening and Morning Student Scores.

    Solution
    1. State the claim and determine the null and alternative hypotheses. The word "greater than" translates to ">."

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 > \mu_2\) Claim

    The test has one tail.

    1. Determine the critical value.

    Calculate \(n_1-1 = 10-1\) = 9 and \(n_2-1 = 11-1\) = 10. The degrees of freedom are 9 as 9 is the minimum of the two values. Looking up the values in the table using d.f. = 9, one tail, and \(\alpha = 0.05\), the critical value is 1.833.

    1. Compute the test point. First, use the calculator to compute the sample means and sample standard deviations. Round to two place values. The results are listed below.
    Data Set
    Evening Student Scores Morning Student Scores
    \(\bar{X}_1=87.7\) \(\bar{X}_2=74.8\)
    \(s_1=7.17\) \(s_2=15.2\)
    \(n_1=10\) \(n_2=10\)

    Table \(\PageIndex{4}\): Summarized Data for the Evening and Morning Student Scores.

    \(t=\dfrac{(87.7-74.8)-(0)}{\sqrt{\dfrac{7.17^{2}}{10}+\dfrac{15.2^2}{10}}}\) = 2.43

    1. Make a decision. For this problem, the decision is to "reject \(H_0\)" because the t-test point falls in the critical region.
    The test point (2.43) falls into the critical region - reject the null hypothesis.
    Figure \(\PageIndex{2}\): The Test Point (2. 43) Falls into the Critical Region - Reject H0.
    1. The summary statement is that "there is enough evidence to support the claim that the average of the exam scores of the evening students is greater than the average of the exam scores of the morning students."
    Example \(\PageIndex{3}\) t-Test Using Traditional (Critical Value) Method

    At Willow Creek High School, students are gearing up for the annual “Battle of the Genders” sports competition. The coach believes that female athletes are putting in fewer hours of practice than the male athletes this season. To test this claim, the coach collects a random sample of practice times (in hours per week) from each group.

    Female and Male Athletes' Summarized Data
    Female Athletes Male Athletes
    \(\bar{X}_1=6.2\) \(\bar{X}_2=7.4\)
    \(s_1=1.1\) \(s_2=1.3\)
    \(n_1=12\) \(n_2=13\)

    Table \(\PageIndex{5}\): Summarized Data for the Female and Male Athletes

    Using a significance level of \( \alpha = 0.005\), test the claim that female athletes practice fewer hours than male athletes.

    Solution
    1. State the claim and determine the null and alternative hypotheses. The word "greater than" translates to ">."

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 < \mu_2\) Claim

    1. Determine the critical value.

    Calculate \(n_1-1 = 12 - 1\) = 11 and \(n_2-1 = 13-1\) = 12. The degrees of freedom are 11, as 11 is the minimum of the two values. Looking up the values in the table using d.f. = 11, one tail, and \(\alpha = 0.005\), the critical value is –3.106.

    1. Compute the test point.

    \(t=\dfrac{(6.2-7.4)-(0)}{\sqrt{\dfrac{1.1^{2}}{12}+\dfrac{1.3^2}{13}}}\) = –2.50

    1. Make a decision. For this problem, the decision is to "not reject \(H_0\)" because the t-test point does not fall into the critical region.
    The test point (t = –2.50) falls into the non - critical region - do not reject the null hypothesis.
    Figure \(\PageIndex{3}\): The Test Point (t = –2.50) Falls into the Non - Critical Region - Do Not Reject H0.

    The TI-84+ calculator can also be used to calculate the test point for a t-test with two independent samples.

    Example \(\PageIndex{4}\) t-Test Using Traditional (Critical Value) Method Using a Graphing Calculator

    The average prices for new 15-lb turkeys sold at commercial markets in California and Texas will be compared. The researcher claims that the average price of a 15-lb Thanksgiving turkey in California is greater than the average price of a 15-lb Thanksgiving turkey in Texas. The data is measured in dollars and presented in the table below. Test the researcher's claim using \(\alpha = 0.01\).

    Data Set
    California Texas
    54 34
    44 30
    26 18
    43 18
    22 29
    47 41
    44 35
    43 20
    41 39
    47 21
    25 28

    Table \(\PageIndex{6}\): Data for the Prices of 15-lb Turkeys in Texas and California.

    Solution
    1. State the claim and determine the null and alternative hypotheses. The word "greater than" translates to ">."

    \(H_0: \mu_1 = \mu_2\)

    \(H_0: \mu_1 > \mu_2\) Claim

    The test has one tail.

    1. Determine the critical value.

    Calculate \(n_1-1 = 11-1\) = 10 and \(n_2-1 = 11-1\) = 10. The degrees of freedom are 10 as 10 is the minimum of the two values. Looking up the values in the table using d.f. = 10, one tail, and \(\alpha = 0.01\), the critical value is 2.764.

    1. Using the calculator to compute the test point. Enter the data into the TI-84+ calculator by pressing [STAT] and then select [1:EDIT]. Enter the data in column 1 into List 1 (L1) and the data in column 2 into List 2 (L2). The results should look like the image below.
    Enter the data into the TI-84+ calculator.
    Figure \(\PageIndex{4}\): Enter the Data into the TI-84+ Calculator

    Press [STAT] and use the right arrow to select [TESTS] and then the down arrow to select [4:2-SampTTest], and then hit the [ENTER] button. Use the left arrow to select "DATA" and then fill in the information provided in the image below.

    Check to make sure the correct lists and other key items are selected.
    Figure \(\PageIndex{5}\): Check to Make Sure the Correct Lists and Other Key Items are Selected.

    After selecting [Calculate] and hitting [ENTER], the output in the image below should appear on the calculator. The test point is t = 2.78 (rounded to two place values) and the p-value is 0.0060 (Rounded to four decimal places).

    The output of the test point and other data.
    Figure \(\PageIndex{6}\): The Output of the Test Point and Other Data
    1. Make a decision. For this problem, the decision is to "reject \(H_0\)" because the t-test point falls in the critical region.
    The test point (2.78) falls into the critical region - reject the null hypothesis.
    Figure \(\PageIndex{7}\): The Test Point (2.78) Falls into the Critical Region - Reject H0
    1. The summary statement is that "there is enough evidence to support the claim that the average price of 15-lb turkeys in California is greater than the average price of 15-lb turkeys in Texas.

    This page titled 9.2: t-Test for the Difference Between Two Means is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Toros Berberyan, Tracy Nguyen, and Alfie Swan via source content that was edited to the style and standards of the LibreTexts platform.