From the free course AP Statistics on Lykke

4.10 Carrying Out a Test for the Difference Between Two Population Means

Key concepts: Two-sample t-statistic = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂) · p-value — tail area beyond the observed t under H₀ · The p-value is computed assuming the two population means are equal · Compare p with α to reject or fail to reject H₀ · Conclusion in context, non-definitive, naming both populations · Statistical significance is not practical importance

When we ask if a new hybrid engine is more efficient than a traditional one, or if students using a specific app score higher than those who don't, we are investigating the difference between two population means ($\mu_1 - \mu_2$).

When we ask if a new hybrid engine is more efficient than a traditional one, or if students using a specific app score higher than those who don't, we are investigating the difference between two population means ($\mu_1 - \mu_2$). Unlike a one-sample test that compares a group to a known standard, the two-sample $t$-test evaluates the "gap" between two independent groups. We use the difference in sample means ($\bar{x}_1 - \bar{x}_2$) to determine if the observed distance is too large to be explained by random sampling variability alone.

An illustration showing two distinct bell curves (representing two populations) and a third distribution representing the possible differences between their sample means. This "difference distribution" is centered at zero under the null hypothesis.

The Two-Sample $t$-Statistic

The core of this inference procedure is the two-sample $t$-test statistic. This value measures how many standard errors the observed difference in sample means falls from the hypothesized difference (usually zero). Because we rarely know the population standard deviations ($\sigma_1, \sigma_2$), we use the sample standard deviations ($s_1, s_2$) to estimate the variability. This substitution is why we use the $t$-distribution rather than the normal distribution.

The Two-Sample $t$-Test Statistic Formula: $$t = \frac{(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2)_0}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$$ Where $(\mu_1 - \mu_2)_0$ is the null hypothesized difference (typically 0).

Calculating the $p$-Value and Degrees of Freedom

The $p$-value is the probability of observing a difference in sample means as extreme as, or more extreme than, the one calculated, assuming the null hypothesis is true. To find this probability, we must identify the correct degrees of freedom ($df$). In AP Statistics, there are two accepted ways to determine $df$:

  1. Technology Approach: Statistical software and graphing calculators use the Satterthwaite approximation, which often results in a non-integer value (e.g., $df = 34.27$). This is the most precise method.
  2. Conservative Approach: Use the smaller of $n_1 - 1$ or $n_2 - 1$. This method is safer because it results in a slightly larger $p$-value, making it harder to reject the null hypothesis incorrectly.

Interactive Two-Sample t-Test Walkthrough: A simulation where learners input sample stats ($\bar{x}, s, n$) for two groups. The tool calculates the $t$-statistic, displays the $t$-distribution with the shaded $p$-value area, and provides the $p$-value using both the conservative and technology $df$ methods.

Interpreting and Justifying Conclusions

Once the $p$-value is calculated, we compare it to the significance level ($\alpha$). If the $p$-value is less than $\alpha$, the results are statistically significant. This leads us to reject the null hypothesis ($H_0$) and conclude there is convincing evidence for the alternative hypothesis ($H_a$). If the $p$-value is greater than $\alpha$, we fail to reject $H_0$, meaning the observed difference could reasonably be attributed to sampling variability.

Misconception Check: Independent vs. Paired A common error is using a two-sample $t$-test for data that is actually paired (e.g., "before and after" measurements on the same people). If the two sets of data are linked or matched, you must use a paired $t$-test (Topic 4.5). The two-sample test discussed here is strictly for independent groups where the selection of individuals in Group 1 has no influence on Group 2.

Worked Example: Battery Longevity

A researcher wants to know if "Brand A" batteries last longer than "Brand B." They test 15 Brand A batteries ($\bar{x}_1 = 190$ mins, $s_1 = 12$) and 20 Brand B batteries ($\bar{x}_2 = 182$ mins, $s_2 = 15$).

  • Hypotheses: $H_0: \mu_A - \mu_B = 0$ vs. $H_a: \mu_A - \mu_B > 0$.
  • Calculation (Skill 3.E): $t = \frac{190 - 182}{\sqrt{\frac{12^2}{15} + \frac{15^2}{20}}} = \frac{8}{4.566} \approx 1.752$.
  • $p$-Value (Skill 4.F): Using $df = 14$ (conservative), $p \approx 0.0508$.
  • Conclusion (Skill 4.G): At $\alpha = 0.05$, since $0.0508 > 0.05$, we fail to reject $H_0$. We do not have convincing evidence that Brand A batteries last longer than Brand B.

Retrieval Check

  1. A two-sample $t$-test gives $p=0.02$ at $\alpha=0.05$. Answer: Reject $H_0$; the result provides convincing evidence for $H_a$ in context.
  2. Why can the conservative degrees-of-freedom method be used? Answer: Using the smaller of $n_1-1$ and $n_2-1$ generally produces a larger $p$-value, so it avoids overstating evidence against $H_0$.
4.10 Carrying Out a Test for the Difference Between Two Population Means - AP Statistics - image 1
4.10 Carrying Out a Test for the Difference Between Two Population Means - AP Statistics - image 1
4.10 Carrying Out a Test for the Difference Between Two Population Means - AP Statistics - diagram 1
4.10 Carrying Out a Test for the Difference Between Two Population Means - AP Statistics - diagram 1

Source Materials

Study AP Statistics on Lykke

This course page is free to open: signed out, you can read its first two sections, and signing in, on any plan, opens the rest. The free Lykke Chrome extension syncs your own Canvas courses, so ChatGPT, Claude and Muse can answer from your classes and deadlines. It only reads Canvas.

Add the free extensionSign in to open every section

All sections of AP Statistics · Browse more course pages