AP® Statistics · Unit 4 · Topic 4.10

Carrying Out a Two-Sample t-Test

A two-sample t-test compares two group means by dividing their difference by the standard error of that difference, then checks how extreme that t value is using a t-distribution.

A big gap between two sample means can still give a weak p-value if the samples are noisy or small, because the test doesn't judge the gap on its own. It judges the gap relative to how much the means would bounce around from sample to sample. That bounce is the standard error, built from both sample standard deviations and both sample sizes. A gap of 6 means something very different if the standard error is 1 than if it's 8. So the t statistic rescales the raw difference into a measure of how many standard errors apart the two means are.

The formula is t = (x-bar1 - x-bar2) / √(s12/n1 + s22/n2). The numerator is the observed difference between the two sample means, usually compared against a hypothesized difference of 0. The denominator is the standard error, found by adding the two groups' variance-per-observation terms (s12/n1 and s22/n2) and taking the square root. This is the unpooled, or Welch, approach, and it's the one used by default: it does not assume the two populations share the same standard deviation. Degrees of freedom come from a messy formula a calculator handles automatically; it lands somewhere between the smaller of n1-1, n2-1 and their sum, and it sets which t-distribution to use for the p-value.

Once you have t and the degrees of freedom, the p-value works exactly like the one-sample case: find the area in the tail(s) of the t-distribution beyond your observed t. Everything else, stating hypotheses, checking conditions like independence and roughly normal or large-enough samples, writing a conclusion in context, carries over from one-sample t-tests. The only new piece is this two-group standard error.

Key terms

Two-sample t statistic
The observed difference between two sample means divided by the standard error of that difference.
Standard error (two-sample)
√(s12/n1 + s22/n2), a measure of how much the difference in sample means would vary across repeated sampling.
Degrees of freedom
A value determined from both sample sizes that sets which t-distribution is used to find the p-value.
Unpooled (Welch) method
The standard two-sample t procedure that keeps each group's variance separate instead of assuming equal population variances.

Watch it explained

  1. How it worksWalk me through the two-sample t statistic, term by term.
  2. Worked exampleFind the t statistic and p-value for x-bar 82 s 9 n 25 against x-bar 76 s 11 n 30.
  3. Worked exampleFind the p-value testing whether a fertilizer raised mean yield from 41.2 to 46.8 bushels.

Check yourself

Your turn1 of 2
Group 1 has n1 = 27, x-bar1 = 85, s1 = 12. Group 2 has n2 = 28, x-bar2 = 71, s2 = 9. Find the two-sample t statistic.

End of topic.