01 / 21
\(\bar{x}_1\) \(\bar{x}_2\)

Difference of Two Means
Hypothesis Test

Learn to carry out a two-sample \(t\)-test comparing the means of two independent populations: state hypotheses, compute the test statistic, and draw conclusions.

AP Statistics

Why Compare Two Means?

In many real-world studies we want to know whether the average outcome differs between two independent groups. For example: does a new drug lower blood pressure more than a placebo? Does one teaching method produce higher test scores than another?

Key Parameters and Statistics

\(\mu_1, \mu_2\)
Population means: the true average for each group (unknown).
\(\bar{x}_1, \bar{x}_2\)
Sample means: point estimates from each sample.
\(s_1, s_2\)
Sample standard deviations: measure spread within each group.

Sampling Distribution of \(\bar{x}_1 - \bar{x}_2\)

0 (under \(H_0\)) \(\bar{x}_1 - \bar{x}_2\) Sampling distribution of \(\bar{x}_1 - \bar{x}_2\) if \(H_0\) true p-value

Stating the Hypotheses

Null Hypothesis
\(H_0\!: \mu_1 - \mu_2 = 0\)
There is no difference between the two population means.
Alternative Hypothesis
\(H_a\!: \mu_1 - \mu_2 \neq 0\) (two-sided)
\(H_a\!: \mu_1 - \mu_2 > 0\) or \(< 0\) (one-sided)

Checking Conditions

1
Random: Both samples must come from random processes (random sampling or random assignment).
2
Independent: The two samples are independent of each other, and each is \(< 10\%\) of its population (10% condition).
3
Normal/Large Sample: Each sample size is at least 30, or the population distributions are roughly normal (check with dotplots/boxplots).

The Test Statistic

The two-sample \(t\) statistic measures how many standard errors the observed difference is from the hypothesized difference:

Under \(H_0\!: \mu_1 - \mu_2 = 0\), the numerator simplifies to just \(\bar{x}_1 - \bar{x}_2\). The denominator is the standard error of the difference.

Degrees of Freedom

The exact (Welch) degrees of freedom are given by a complex formula. On the AP exam, you will either:

Calculator / Table
Use technology to compute the Welch df automatically (this is the standard approach).
Conservative df
Use \(\text{df} = \min(n_1 - 1,\; n_2 - 1)\) for a quick, conservative estimate.

Two-Sample \(t\) vs Paired \(t\)

Two-Sample \(t\) Paired \(t\)
Design Two independent groups One group, two measurements
Data used \(\bar{x}_1 - \bar{x}_2\) \(\bar{d}\) (mean of differences)
SE formula \(\sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}}\) \(\frac{s_d}{\sqrt{n}}\)
Example Drug A group vs Drug B group Before vs after treatment on same subjects

How to Carry Out the Test

1
State: Write \(H_0\) and \(H_a\) in terms of \(\mu_1 - \mu_2\). Define each parameter in context.
2
Plan: Name the procedure (two-sample \(t\)-test). Check Random, Independent, and Normal/Large Sample conditions.
3
Do: Compute the test statistic \(t\) and the p-value using the \(t\)-distribution with the appropriate df.
4
Conclude: Compare the p-value to \(\alpha\). Write a conclusion in context about the population means.

Example 1: Sleep Study

A researcher randomly assigns 40 students to a meditation group (\(n_1 = 20\)) and a control group (\(n_2 = 20\)). After 4 weeks, she records average nightly sleep (hours):

Meditation
\(\bar{x}_1 = 7.4\), \(s_1 = 0.8\), \(n_1 = 20\)
Control
\(\bar{x}_2 = 6.9\), \(s_2 = 1.0\), \(n_2 = 20\)

Example 1: Calculation

Example 2: Fertilizer Yield

A farmer randomly selects 35 plots for Fertilizer A and 30 plots for Fertilizer B. The yields (kg) are summarized below. Test at \(\alpha = 0.05\) whether the mean yields differ.

Fertilizer A
\(\bar{x}_1 = 52.3\), \(s_1 = 6.1\), \(n_1 = 35\)
Fertilizer B
\(\bar{x}_2 = 49.7\), \(s_2 = 5.8\), \(n_2 = 30\)

Interpreting the p-value

The p-value answers one specific question: If the null hypothesis were true, what is the probability of getting a test statistic as extreme as (or more extreme than) the one we observed?

0 Reject \(H_0\) Reject \(H_0\) Fail to Reject \(H_0\) \(-t^*\) \(t^*\)

Common Mistakes

✕ Wrong Test Choice
Using a paired \(t\)-test when the samples are independent, or vice versa. Always ask: are subjects linked?
✕ Skipping Conditions
Failing to verify Random, Independent, and Normal/Large Sample. Each must be stated and checked.
✕ One-Sided vs Two-Sided
Using a two-sided p-value when \(H_a\) is one-sided, or forgetting to double the p-value for two-sided tests.
✕ Generic Conclusion
Writing "reject \(H_0\)" without connecting to the context. Always interpret in terms of the original variables.
✕ Proving \(H_0\)
Saying "we accept \(H_0\)." Correct phrasing: "we fail to reject \(H_0\)" or "there is not convincing evidence that..."

Summary Reference Table

Step What to Write
Hypotheses \(H_0\!: \mu_1 - \mu_2 = 0\); choose \(H_a\) direction
Conditions Random, Independent (10%), Normal/Large
Test Statistic \(t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}}\)
Degrees of Freedom Calculator df or \(\min(n_1-1, n_2-1)\)
P-value From \(t\)-distribution; double if two-sided
Conclusion Compare p to \(\alpha\); state in context

Question 1 of 5

A two-sample \(t\)-test is appropriate when the data come from:

Question 2 of 5

Given \(\bar{x}_1 = 85\), \(\bar{x}_2 = 80\), \(s_1 = 10\), \(s_2 = 12\), \(n_1 = 25\), \(n_2 = 25\). What is the standard error of \(\bar{x}_1 - \bar{x}_2\)?

Question 3 of 5

A researcher tests \(H_0\!: \mu_1 - \mu_2 = 0\) vs \(H_a\!: \mu_1 - \mu_2 \neq 0\) and finds \(t = 2.15\) with \(\text{df} = 40\). The one-sided p-value is 0.019. What is the correct two-sided p-value?

Question 4 of 5

Which of the following is a correct conclusion when the p-value is greater than \(\alpha\)?

Question 5 of 5

At \(\alpha = 0.05\), which is the best conclusion?