U7.9 Two-Sample t-Test
Master the two-sample t-test for a difference of means: hypotheses, conditions, test statistic, p-value, and how it differs from matched pairs.
What you'll do in this lesson
A voice-first session with the Crimsora tutor on U7.9 Two-Sample t-Test, then targeted practice and FRQs — with the tutor adapting to where you get stuck.
What this lesson covers
When you want to know whether two independent groups differ on average — say, exam scores for two teaching methods or gas mileage for two car brands — you use a two-sample t-test for a difference of means. This lesson shows you how to set up the hypotheses, check conditions, compute the test statistic, and write a conclusion in context.
The biggest trap on the AP exam is confusing this procedure with the matched-pairs t-test. They look similar but rest on completely different data structures. By the end of this guide you will be able to tell them apart instantly and carry out the two-sample test cleanly.
The biggest trap on the AP exam is confusing this procedure with the matched-pairs t-test. They look similar but rest on completely different data structures. By the end of this guide you will be able to tell them apart instantly and carry out the two-sample test cleanly.
Setting Up the Hypotheses
A two-sample t-test compares two population (or true treatment) means, and , using two independent samples. The parameter of interest is the difference .
The null hypothesis almost always states no difference:The alternative depends on the question. Use for a two-sided test, or or for one-sided claims.
Always define your subscripts explicitly in words. Write, for example, " = the true mean recovery time for the drug group and = the true mean recovery time for the placebo group." The AP rubric expects parameters defined in context, not just symbols. A common misconception is treating as the hypothesized value — remember hypotheses are about population parameters, and the statistic is what you compute from data.
The null hypothesis almost always states no difference:The alternative depends on the question. Use for a two-sided test, or or for one-sided claims.
Always define your subscripts explicitly in words. Write, for example, " = the true mean recovery time for the drug group and = the true mean recovery time for the placebo group." The AP rubric expects parameters defined in context, not just symbols. A common misconception is treating as the hypothesized value — remember hypotheses are about population parameters, and the statistic is what you compute from data.
Checking Conditions
Before computing, verify three conditions and state them with evidence.
Random: The data come from two independent random samples or from a randomized experiment that assigns subjects to two treatment groups.
Independence (10% rule): For sampling without replacement, each sample size should be no more than 10% of its population. The two groups must also be independent of each other — this is what separates the two-sample setting from matched pairs.
Normal/Large Sample: Each population is approximately Normal, OR each sample size is at least 30 (Central Limit Theorem), OR graphs of each sample (dotplots, boxplots) show no strong skew or outliers.
Skipping the condition check, or checking normality on the combined data rather than each group separately, costs points.
Random: The data come from two independent random samples or from a randomized experiment that assigns subjects to two treatment groups.
Independence (10% rule): For sampling without replacement, each sample size should be no more than 10% of its population. The two groups must also be independent of each other — this is what separates the two-sample setting from matched pairs.
Normal/Large Sample: Each population is approximately Normal, OR each sample size is at least 30 (Central Limit Theorem), OR graphs of each sample (dotplots, boxplots) show no strong skew or outliers.
| Condition | What to check | What to write |
|---|---|---|
| Random | How data were collected | "Two independent random samples" |
| Independence | of population; groups independent | Cite population size |
| Normal | or graph shape | Describe each sample's plot |
The Test Statistic and P-Value
The two-sample t statistic measures how many standard errors the observed difference lies from the hypothesized difference of 0:The denominator is the standard error of the difference. Notice the variances are added — never subtract, and never pool unless the problem specifically directs you to assume equal variances (the AP default does not pool).
Degrees of freedom come from a messy formula that technology computes automatically; on the exam you may report the calculator's df (often a decimal) or use the conservative smaller of and . Either is accepted.
Once you have and df, find the p-value as the tail area matching your . For a two-sided test, double the one-tail probability. Compare the p-value to the significance level (usually 0.05): if p-value , reject ; otherwise, fail to reject.
Degrees of freedom come from a messy formula that technology computes automatically; on the exam you may report the calculator's df (often a decimal) or use the conservative smaller of and . Either is accepted.
Once you have and df, find the p-value as the tail area matching your . For a two-sided test, double the one-tail probability. Compare the p-value to the significance level (usually 0.05): if p-value , reject ; otherwise, fail to reject.
Two-Sample vs. Matched-Pairs
This distinction is tested constantly. The deciding factor is the data structure, not the story.
Use a two-sample t-test when you have two separate, independent groups of subjects — different people, animals, or objects in each group, with no natural link between an observation in group 1 and one in group 2.
Use a matched-pairs t-test when each observation in one condition is naturally paired with a specific observation in the other: the same subject measured twice (before/after), twins, or left/right measurements. You then reduce each pair to a single difference and run a one-sample t-test on those differences.
If you can shuffle one group's values without changing meaning, the groups are independent (two-sample). If each value has a designated partner, it is paired. Choosing the wrong procedure typically means zero credit for the setup even if arithmetic is correct.
Use a two-sample t-test when you have two separate, independent groups of subjects — different people, animals, or objects in each group, with no natural link between an observation in group 1 and one in group 2.
Use a matched-pairs t-test when each observation in one condition is naturally paired with a specific observation in the other: the same subject measured twice (before/after), twins, or left/right measurements. You then reduce each pair to a single difference and run a one-sample t-test on those differences.
| Feature | Two-Sample | Matched-Pairs |
|---|---|---|
| Data | Two independent groups | Paired observations |
| Parameter | (mean difference) | |
| Procedure | Two-sample | One-sample on differences |
| Sample sizes | Can differ | Always equal (paired) |
Key terms
- Two-sample t-test.
- A significance test comparing the means of two independent populations or treatment groups using .
- Standard error of the difference.
- The estimated standard deviation of , equal to .
- Independent samples.
- Samples in which observations in one group are unrelated to observations in the other, a requirement for the two-sample procedure.
- Matched-pairs design.
- A design that links each observation in one condition to a specific observation in the other, analyzed with a one-sample t-test on differences.
- Null hypothesis .
- The claim of no difference between means, typically .
- P-value.
- The probability, assuming is true, of getting a difference at least as extreme as the one observed.
- Degrees of freedom.
- A parameter of the t-distribution; found by technology or conservatively as the smaller of and .
Worked example
A researcher tests whether a new fertilizer increases tomato yield. She randomly assigns 15 plants to the new fertilizer and 15 to the standard fertilizer. The new group has kg, kg; the standard group has kg, kg. Test at whether the new fertilizer produces a higher mean yield.
State parameters: let = true mean yield with new fertilizer, = true mean yield with standard fertilizer.
Hypotheses: versus (one-sided, since she suspects an increase).
Conditions: Random — plants were randomly assigned to treatments, so this is a randomized experiment. Independence — the two treatment groups are independent by random assignment. Normal — with we would examine graphs; assume the problem states the samples show no strong skew or outliers, so the condition is met.
Test statistic:Using the conservative df , the one-tailed p-value for is about 0.032.
Conclusion: Since p-value , we reject . There is convincing statistical evidence that the new fertilizer produces a higher mean tomato yield than the standard fertilizer.
Hypotheses: versus (one-sided, since she suspects an increase).
Conditions: Random — plants were randomly assigned to treatments, so this is a randomized experiment. Independence — the two treatment groups are independent by random assignment. Normal — with we would examine graphs; assume the problem states the samples show no strong skew or outliers, so the condition is met.
Test statistic:Using the conservative df , the one-tailed p-value for is about 0.032.
Conclusion: Since p-value , we reject . There is convincing statistical evidence that the new fertilizer produces a higher mean tomato yield than the standard fertilizer.
Practice questions
A study measures the blood pressure of 40 patients before and after taking a medication, then compares the before and after readings. Which procedure is appropriate?
- Two-sample t-test for a difference of means
- Matched-pairs t-test (one-sample t-test on the differences)
- Two-sample z-test for proportions
- One-sample t-test on the after readings only
Answer: Matched-pairs t-test (one-sample t-test on the differences)
Each patient is measured twice, so before and after readings are naturally paired to the same person. The correct approach reduces each pair to a difference and runs a one-sample t-test on those differences. A two-sample test would wrongly treat the two sets of readings as independent groups.
Two independent random samples give , , and , , . Compute the two-sample t statistic for and interpret whether it is large.
Answer:
The standard error is . Then . A t of about 2.11 means the observed difference is just over two standard errors from 0, which for typical df gives a two-sided p-value near 0.04 — moderately strong evidence against at .
Explain why the variances are added, not subtracted, in the standard error of .
Answer: Because the variance of a difference of independent random variables equals the sum of their variances.
For independent variables, . Variances of independent quantities always add regardless of the sign in the combination, so we add and . Taking the square root gives the standard error. Subtracting could even yield a negative number under the root, which is impossible for a standard deviation.
FAQ
- How do I know whether to use a two-sample or matched-pairs t-test?
- Look at the data structure. If each observation in one group is naturally linked to a specific observation in the other (same subject before/after, twins, paired objects), use matched pairs. If the two groups consist of separate, unrelated subjects, use the two-sample test. The story about the experiment matters less than whether observations are paired.
- Should I pool the variances on the AP exam?
- No. The default two-sample t-procedure taught in AP Statistics does not assume equal variances and does not pool. Use the unpooled formula with separate and . Only pool if a problem explicitly instructs you to assume equal population variances, which is rare.
- What degrees of freedom should I report?
- You may report the value your calculator gives (often a non-integer from the Welch–Satterthwaite formula) or use the conservative choice, the smaller of and . Both are accepted on the AP exam; the conservative df gives a slightly larger p-value.
- Can the two sample sizes be different?
- Yes. Unlike matched pairs, the two-sample t-test allows because the groups are independent and need not be linked. The formula accounts for each sample size separately in the standard error.
Learn this with a teacher, not a page
The Crimsora tutor teaches U7.9 Two-Sample t-Test live — explaining on a whiteboard, asking you questions, and adapting to where you get stuck.