AP-STATS-7.9-7.10

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.

Setting Up the Hypotheses

A two-sample t-test compares two population (or true treatment) means, μ1\mu_1 and μ2\mu_2, using two independent samples. The parameter of interest is the difference μ1μ2\mu_1 - \mu_2.

The null hypothesis almost always states no difference:H0:μ1μ2=0(equivalently μ1=μ2)H_0: \mu_1 - \mu_2 = 0 \quad \text{(equivalently } \mu_1 = \mu_2\text{)}The alternative depends on the question. Use Ha:μ1μ20H_a: \mu_1 - \mu_2 \neq 0 for a two-sided test, or Ha:μ1μ2>0H_a: \mu_1 - \mu_2 > 0 or <0< 0 for one-sided claims.

Always define your subscripts explicitly in words. Write, for example, "μ1\mu_1 = the true mean recovery time for the drug group and μ2\mu_2 = 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 xˉ1xˉ2\bar{x}_1 - \bar{x}_2 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.
ConditionWhat to checkWhat to write
RandomHow data were collected"Two independent random samples"
Independencen10%n \le 10\% of population; groups independentCite population size
Normaln30n \ge 30 or graph shapeDescribe each sample's plot
Skipping the condition check, or checking normality on the combined data rather than each group separately, costs points.

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:t=(xˉ1xˉ2)0s12n1+s22n2t = \frac{(\bar{x}_1 - \bar{x}_2) - 0}{\sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}}}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 n11n_1 - 1 and n21n_2 - 1. Either is accepted.

Once you have tt and df, find the p-value as the tail area matching your HaH_a. For a two-sided test, double the one-tail probability. Compare the p-value to the significance level α\alpha (usually 0.05): if p-value <α< \alpha, reject H0H_0; 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.
FeatureTwo-SampleMatched-Pairs
DataTwo independent groupsPaired observations
Parameterμ1μ2\mu_1 - \mu_2μd\mu_d (mean difference)
ProcedureTwo-sample ttOne-sample tt on differences
Sample sizesCan differAlways equal (paired)
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.

Key terms

Two-sample t-test.
A significance test comparing the means of two independent populations or treatment groups using μ1μ2\mu_1 - \mu_2.
Standard error of the difference.
The estimated standard deviation of xˉ1xˉ2\bar{x}_1 - \bar{x}_2, equal to s12/n1+s22/n2\sqrt{s_1^2/n_1 + s_2^2/n_2}.
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 H0H_0.
The claim of no difference between means, typically μ1μ2=0\mu_1 - \mu_2 = 0.
P-value.
The probability, assuming H0H_0 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 n11n_1-1 and n21n_2-1.

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 xˉ1=4.8\bar{x}_1 = 4.8 kg, s1=0.9s_1 = 0.9 kg; the standard group has xˉ2=4.1\bar{x}_2 = 4.1 kg, s2=1.0s_2 = 1.0 kg. Test at α=0.05\alpha = 0.05 whether the new fertilizer produces a higher mean yield.
State parameters: let μ1\mu_1 = true mean yield with new fertilizer, μ2\mu_2 = true mean yield with standard fertilizer.

Hypotheses: H0:μ1μ2=0H_0: \mu_1 - \mu_2 = 0 versus Ha:μ1μ2>0H_a: \mu_1 - \mu_2 > 0 (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 n1=n2=15<30n_1 = n_2 = 15 < 30 we would examine graphs; assume the problem states the samples show no strong skew or outliers, so the condition is met.

Test statistic:t=(4.84.1)00.9215+1.0215=0.70.054+0.0667=0.70.1207=0.70.34742.01t = \frac{(4.8 - 4.1) - 0}{\sqrt{\dfrac{0.9^2}{15} + \dfrac{1.0^2}{15}}} = \frac{0.7}{\sqrt{0.054 + 0.0667}} = \frac{0.7}{\sqrt{0.1207}} = \frac{0.7}{0.3474} \approx 2.01Using the conservative df =14= 14, the one-tailed p-value for t=2.01t = 2.01 is about 0.032.

Conclusion: Since p-value 0.032<0.05\approx 0.032 < 0.05, we reject H0H_0. 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?
  1. Two-sample t-test for a difference of means
  2. Matched-pairs t-test (one-sample t-test on the differences)
  3. Two-sample z-test for proportions
  4. 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 xˉ1=52\bar{x}_1 = 52, s1=6s_1 = 6, n1=25n_1 = 25 and xˉ2=48\bar{x}_2 = 48, s2=8s_2 = 8, n2=30n_2 = 30. Compute the two-sample t statistic for H0:μ1μ2=0H_0: \mu_1 - \mu_2 = 0 and interpret whether it is large.

Answer: t2.11t \approx 2.11

The standard error is 62/25+82/30=1.44+2.133=3.5731.890\sqrt{6^2/25 + 8^2/30} = \sqrt{1.44 + 2.133} = \sqrt{3.573} \approx 1.890. Then t=(5248)/1.8902.11t = (52 - 48)/1.890 \approx 2.11. 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 H0H_0 at α=0.05\alpha = 0.05.
Explain why the variances are added, not subtracted, in the standard error of xˉ1xˉ2\bar{x}_1 - \bar{x}_2.

Answer: Because the variance of a difference of independent random variables equals the sum of their variances.

For independent variables, Var(xˉ1xˉ2)=Var(xˉ1)+Var(xˉ2)Var(\bar{x}_1 - \bar{x}_2) = Var(\bar{x}_1) + Var(\bar{x}_2). Variances of independent quantities always add regardless of the sign in the combination, so we add s12/n1s_1^2/n_1 and s22/n2s_2^2/n_2. 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 s12s_1^2 and s22s_2^2. 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 n11n_1 - 1 and n21n_2 - 1. 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 n1n2n_1 \neq n_2 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.