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.
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
Sampling Distribution of \(\bar{x}_1 - \bar{x}_2\)
Stating the Hypotheses
There is no difference between the two population means.
\(H_a\!: \mu_1 - \mu_2 > 0\) or \(< 0\) (one-sided)
Checking Conditions
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:
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
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):
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.
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?
Common Mistakes
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
Study: A school district randomly assigns 50 students to an online math program and 50 students to a traditional classroom. After one semester, the online group has \(\bar{x}_1 = 78\), \(s_1 = 9\) and the classroom group has \(\bar{x}_2 = 74\), \(s_2 = 11\). The two-sample \(t\)-test yields \(t = 2.00\) with 92 df and a two-sided p-value of 0.048.
At \(\alpha = 0.05\), which is the best conclusion?