Bell Statistics

What is a paired t-test?

A paired t-test compares two measurements taken on the same units — the same users before and after, or the same markets under two conditions. It analyses the differences within each pair, which removes variation between units from the comparison entirely.

Also called
dependent samples t-test, repeated measures t-test, matched pairs t-test, within-subjects test
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

Some comparisons come with a natural partner for every observation. The same users measured before and after a change; the same geographic markets under two media plans; the same accounts scored by two models. In all of those the two numbers being compared share whatever makes that unit distinctive, and a paired t-test exploits that instead of throwing it away.

The mechanism is almost embarrassingly simple: compute the difference within each pair, then run a one-sample t-test on those differences against zero. What that accomplishes is not simple at all. Between-unit variation — the fact that some users are heavy and some are light, some markets large and some small — vanishes from the calculation, because it is present in both halves of every pair and subtracts out. What remains is only the variation in how much each unit *changed*, which is usually far smaller.

That reduction is the entire value, and it can be dramatic. If users vary enormously in baseline spend but the treatment moves everyone by roughly the same amount, the unpaired comparison is drowning in between-user noise while the paired one sees a clean signal. Sample-size savings of five to ten times are ordinary in that situation. The relevant quantity is the correlation between the two measurements: the higher it is, the more a pairing buys, which is exactly the logic CUPED applies to a pre-experiment covariate rather than a second measurement.

The reason this is not the default in online experimentation is that pairing usually is not available. A standard A/B test shows each user one variant, so there is no second measurement to pair with — the arms contain different people and the comparison is unavoidably between units. Attempting to manufacture pairs by matching users on observed characteristics is not the same thing and reintroduces every problem propensity score matching has. Where pairing genuinely does appear is geo testing, where markets are matched on pre-period behaviour, and in before-and-after designs, which carry their own threats from seasonality and trend.

There is one honest cost. A paired design halves the degrees of freedom compared with an unpaired test on the same total number of measurements, since n pairs give n − 1 rather than 2n − 2. When the pairing is weak — the two measurements barely correlate — that loss is not repaid and the paired test is genuinely worse. Pairing on something irrelevant is not a free option.

The formula

A one-sample test on the within-pair differences. Everything that makes it powerful is contained in the fact that the differences, not the raw values, are what get analysed.

The differences
dᵢ = x₁ᵢ − x₂ᵢ, for each pair i

This single step is what removes between-unit variation. Everything after it is a one-sample test.

The statistic
t = d̄ / ( s_d / √n )

d̄ is the mean difference, s_d its standard deviation, n the number of PAIRS — see the paired t-test calculator.

Degrees of freedom
df = n − 1

Pairs minus one, not observations minus two. Half what an unpaired test on the same measurements would have.

Variance of the difference
Var(d) = σ₁² + σ₂² − 2ρσ₁σ₂

The whole case for pairing. At ρ = 0.9 with equal variances this is a fifth of the unpaired variance; at ρ = 0 it is larger.

Worked example

A geo test runs a campaign in 24 matched market pairs, one treated and one held back in each pair. Weekly revenue per market averages £182,000 with a standard deviation of £96,000 — markets differ enormously in size. The treatment lifts revenue by £4,100 per market on average, and the pre-period correlation within pairs is 0.94.

Pairs
24 matched markets
Between-market SD
£96,000
Mean within-pair difference
£4,100
SD of the differences
£8,300
Paired t
4,100 / (8,300 / √24) = 2.42
Unpaired t on the same data
≈ 0.15

Paired: t(23) = 2.42, p = 0.024. Unpaired: p = 0.88, no effect detectable at all.

The same data, analysed two ways, and only one of them can see anything. Unpaired, the £4,100 effect is buried under a £96,000 standard deviation between markets — London and Hull differ far more from each other than either differs from itself under two media plans. Pairing removes that entirely and leaves an £8,300 spread in how much each pair moved, against which £4,100 is visible. This is why geo tests are built on matched markets rather than randomly split ones, and it is also where the design's fragility lives: the whole gain depends on the 0.94 correlation holding into the test period. If a matched pair diverges for an unrelated reason — one market has a store closure, a competitor enters the other — the pairing that bought this precision is also what carries the contamination straight into the estimate.

Common misconceptions

A paired t-test is just a t-test with the data organised differently.
It is a different test on a different quantity. The unpaired version analyses two sets of values and their separate spreads; the paired version analyses one set of differences and only their spread. That is why the two can disagree so completely on identical data — one is looking at variation between units and the other has removed it.
Pairing always improves precision, so pair whenever you can.
Only when the paired measurements actually correlate. The variance of a difference is σ₁² + σ₂² − 2ρσ₁σ₂, so at ρ = 0 pairing gives no reduction while still halving the degrees of freedom — a strictly worse test. Pairing on an irrelevant characteristic costs power rather than saving it.
A before-and-after comparison on the same users is a clean paired test.
The arithmetic is right and the causal claim usually is not. Between the two measurements sit seasonality, product releases, marketing campaigns and the users' own growing familiarity, and a paired test attributes all of it to the treatment. Pairing controls for differences between units, not for anything that happened over time — that needs a concurrent control group.

Frequently asked questions

When can I actually use a paired t-test in an A/B test?
Rarely in a standard one, because each user sees a single variant and there is no second measurement to pair with. Where it does apply is geo testing with matched markets, switchback designs where the same unit passes through both conditions at different times, interleaving experiments in search and recommendations, and before-and-after studies — though that last case needs a concurrent control to be causally meaningful.
How much smaller a sample does pairing need?
It depends entirely on the correlation between the paired measurements. The variance of the difference is reduced by a factor of roughly (1 − ρ) when the two have similar spread, so ρ = 0.5 halves it, ρ = 0.9 cuts it to a tenth, and ρ = 0 gives nothing back. Measure the correlation on historical data before committing to a paired design — it is the single number that decides whether the design is worth it.
What do I do with unpaired leftovers?
Drop them from the paired analysis. The test operates on complete pairs and a unit with only one measurement contributes no difference to compute. If a substantial share of pairs is incomplete, that is worth investigating in its own right — attrition that correlates with the treatment is a selection problem, and it will bias the result no matter which test is run on what remains.

Related terms

  • ANOVA

    One test for three or more variants — and the reason it deliberately refuses to say which one won.

  • Chi-square test

    The test for counts in a table — the standard SRM check, and the reason expected counts matter more than sample size.

  • Mann-Whitney U test

    Compares by rank instead of by mean, so one whale cannot move the result — and answers a subtly different question.

  • Standard error

    How much your estimate would move if you ran the study again — precision, not spread.

  • T-test

    The workhorse for comparing two averages — and the four assumptions that decide whether its answer means anything.

  • McNemar's test

    The paired test for yes-or-no outcomes — and it throws away every subject who did not change their mind.

Calculate it

  • Paired t-test

    Before-and-after or matched pairs — size the study on the difference SD, then test it.

  • McNemar's test

    Paired yes/no data — only the pairs that disagree carry any information, and this sizes on them.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.

References