Bell Statistics

Paired t-test calculator

Plan how many pairs you need before you run, then get the t statistic, p-value and confidence interval on the mean difference once the data is in. Everything here turns on one number that the [two-sample test](/calculators/two-sample-t-test) never asks for: the correlation between the two measurements.

Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

Calculator

The mean within-pair change, in your units.

Most people have the first, not the second.

The lever. 0.8 more than halves the sample.

Required number of pairs
PairsSubjects, each measured twice.69
MeasurementsTwo per pair. This is not n.138
Achieved powerAt the whole number of pairs above.80.0%
SD of the differences (σ_d)4382
Effect size (Cohen's dz)Standardised on σ_d, not on either column.0.342

Measure 69 pairs twice — 138 measurements — and the test will detect a mean change of 1500 80.0% of the time, if a change that large is really there. n is the 69, not the 138: the pairs are what carry independent information. The number rests on σ_d of 4382, which came from your correlation rather than from either standard deviation — if that correlation is a guess, this answer is a guess of the same quality.

Sample size pairs against statistical powerReaching 4.3% power takes 2 pairs and 97.9% takes 138; the 80.0% target is met at 69.204060801001200%25%50%75%100%PowerSample size — pairs80.0% → 69

Drag the dashed line — or focus it and use the arrow keys — to change the target power and resize the study.

Show these numbers as a table
Power at each sample size pairs
PowerSample size
4.3%2
19.1%12
33.5%22
46.7%32
58.2%42
67.8%52
75.6%62
81.7%72
86.5%82
90.1%92
92.8%102
94.9%112
96.3%122
97.4%132
Required pairs against mean change worth detectingDetecting 219 takes 3,142 and 5260 takes 8. At the 1500 currently entered it is 69 — the requirement falls roughly as the square of the effect.101001,00010002000300040005000Mean change worth detectingRequired pairs (log scale)1500 → 69

Drag the dashed line — or focus it and use the arrow keys — to change mean change worth detecting.

Show these numbers as a table
Required pairs against mean change worth detecting
Mean change worth detectingRequired pairs
2193,142
736281
125098
177051
229031
280022
332016
384013
435011
48709

When to use it

Use a paired t-test when every observation in one condition has a natural partner in the other: the same user before and after a change, the same store in two consecutive periods, two units matched on the covariates that drive the outcome. The test does not really compare two groups — it collapses each pair to one difference and asks whether their average is zero. Hence n is the number of pairs, not of measurements, and the SD that governs the sample size is the SD of the differences, not of the outcome.

The whole argument for pairing lives in the correlation between the two measurements. Because σ_d = √(σ₁² + σ₂² − 2rσ₁σ₂), a strong positive correlation shrinks the noise you test against: with equal SDs and r = 0.8 the difference SD is 0.63σ, and the design needs roughly a fifth of the measurements an independent-groups test would. At r = 0 it needs exactly the same measurements and has half the degrees of freedom — pairing has cost you something and bought you nothing. At r < 0 it is actively worse. This is the lever CUPED pulls, and one of the ways to buy power without buying traffic.

If the units in your two conditions are different people the pairing does not exist, and you want the two-sample t-test: pairing observations that were never paired is not a conservative mistake, it is the wrong standard error. Paired binary outcomes want McNemar's test, which runs on the same idea and discards the pairs that agree. Heavily skewed differences want the Wilcoxon signed-rank test. Three or more conditions on the same unit need a repeated-measures model, not one-way ANOVA.

Assumptions

The paired test trades one assumption set for another. It drops independence between groups entirely — the two measurements are meant to be correlated — and takes on these instead:

  • The pairs are independent of each other. Within a pair correlation is the point; across pairs it is a violation — two stores in the same shopping centre are not two independent pairs.
  • The pairing is fixed by the design, not chosen after the data arrived. Matching units post hoc on a variable you have already inspected, or dropping pairs whose difference looks wrong, leaves the test with no honest error rate.
  • The differences are approximately normal — not the raw measurements. This is the assumption people misread most often: two wildly skewed distributions can produce symmetric differences, and two well-behaved series can produce differences with a heavy tail. Plot the differences, not the levels. Above about 30 pairs the Central Limit Theorem does most of the work; below that see what to do when data is not normally distributed.
  • No single pair dominates. The difference SD comes from the same n differences as the mean, so one extreme pair either inflates the denominator or, running with the effect, manufactures one — see tackling outliers.
  • None of this rescues a before-and-after design from the absence of a control. The test says the mean changed, not that you changed it: seasonality, a pricing move and a competitor's campaign all sit in the same window. There, a geo test or an explicit causal design is what you need.

How the calculation works

The sample-size tab solves the exact non-central t power function on the difference scale, so the answer is in pairs, not observations. Enter the difference SD directly if you have historical paired data, or enter σ₁, σ₂ and a correlation and let the calculator derive it — most people know the SD of their metric and have never computed the SD of its period-over-period change. If you have no idea what the correlation is, that is the number to go and find, because it moves the answer far more than the [allocation choices](/calculators/ab-test-sample-size) people spend longer arguing about.

The differences
dᵢ = x₁ᵢ − x₂ᵢ, n = number of pairs

Everything downstream is a one-sample t-test on these n numbers.

Test statistic
t = d̄ / (s_d/√n), df = n − 1

n − 1 degrees of freedom rather than the 2n − 2 an independent-groups test on the same measurements would have. That gap is the fixed cost of pairing.

Difference SD from a correlation
σ_d = √(σ₁² + σ₂² − 2rσ₁σ₂)

With σ₁ = σ₂ = σ this is σ√(2 − 2r): 1.41σ at r = 0, 1.00σ at r = 0.5, 0.63σ at r = 0.8, 0.32σ at r = 0.95 — and sample size scales with the square of that factor.

Effect size
d_z = δ / σ_d

Cohen's d_z, standardised on the difference SD. It is not the d you would quote for an independent-groups test and is not comparable with it — reporting one as the other flatters a paired study.

Power
1 − β = P( |T′| > t₁₋α/₂,ₙ₋₁ ), ncp = d_z·√n

T′ is non-central t on n − 1 degrees of freedom. Achieved power is reported at the rounded-up n.

Confidence interval
d̄ ± t₁₋α/₂,ₙ₋₁ · s_d/√n

On the mean difference, in the original units. It excludes zero exactly when p < α.

Worked example

You are rolling out a new shelf layout, measuring each store for four weeks before and four weeks after. Revenue per store per period has a standard deviation across stores of about $8,000, and consecutive periods have historically correlated at around 0.85. The smallest lift that would justify the rollout is $1,500 per store.

Significance level (α)
0.05, two-sided
Power (1 − β)
0.80
Smallest difference worth detecting
1,500
SD, period 1 (σ₁)
8,000
SD, period 2 (σ₂)
8,000
Correlation between periods (r)
0.85

σ_d works out at about $4,380, giving d_z ≈ 0.34 and a requirement of roughly 69 stores measured twice — about 138 measurements, with achieved power a little over 80%.

The comparison worth making is against the unpaired version: detecting a $1,500 difference between two independent sets of stores with an $8,000 SD would need something in the region of 450 stores per arm, close to 900 in all. Pairing does not make the effect bigger — it removes the stable between-store differences (location, footfall, catchment income) that are most of that $8,000. Note also how fragile the answer is: at r = 0.7 rather than 0.85, σ_d rises to roughly $6,200 and the requirement roughly doubles. The correlation is the input to interrogate, not the effect size.

Interpreting the output

Read the confidence interval on the mean difference before the p-value. It is in the units you care about and gives the range of true differences the data is compatible with. An interval of [$120, $3,900] is significant and nearly useless: it cannot distinguish a rounding error from a result that funds the programme twice over. An interval of [−$200, $180] is not significant but is genuinely informative, because it rules out anything worth acting on — the argument of our note on reporting results properly.

Then check the realised s_d against the one you assumed at design time — that comparison is the post-mortem for the whole study. If it came in well above your assumption, the two measurements were less correlated than history suggested and the test is underpowered for reasons unrelated to the effect. That is a different diagnosis from "there is no effect", and it points to a better matching variable rather than to abandoning the idea.

The p-value carries a smaller claim than most write-ups give it: the probability of a mean difference this large if the true difference were zero. Nothing about causation, and in a before-and-after design nothing separating your intervention from everything else that happened in between. Where the two periods are not comparable, add a concurrent control — which turns this into a two-sample comparison on the differences — or build the counterfactual with causal inference.

Finally, a non-significant paired test does not show the two conditions are interchangeable. If the question is whether the cheaper supplier hurts anything, nominate a margin in advance and run an equivalence test, or a non-inferiority test when only one direction of harm matters. Those are claims you can put in a decision memo; a large p-value is not.

Frequently asked questions

I don't know the correlation between my two measurements. What do I enter?
Compute it from history rather than guessing: take the same units over two past periods of the same length, and correlate the metric across them. For stable unit-level metrics measured over reasonable windows — revenue per store, weekly sessions per account — correlations of 0.7 to 0.9 are common. For volatile individual-level metrics over short windows they can be far lower. If you truly have nothing, enter a conservative 0.5 and treat the resulting sample size as a floor, because the cost of overestimating the correlation is an underpowered study, not a cautious one.
Is n the number of pairs or the number of measurements?
Pairs. Sixty users measured twice is n = 60, with 59 degrees of freedom, not n = 120. This is the most common arithmetic error in paired designs, and it produces a t statistic that is too large and a p-value that is too small by a wide margin. The 120 measurements are real work, but they buy 60 independent pieces of information about the difference.
Should I pair at all, or just run two independent groups?
Pair when you expect the two measurements to be strongly correlated and pairing is operationally cheap. The break-even is roughly a correlation of zero: below it you are paying degrees of freedom for nothing, above it the gain grows quickly, and at 0.8 you need something like a fifth of the measurements. But pairing also imposes constraints that independent groups do not — order effects, carryover, and the fact that a before-and-after version has no concurrent control — so a high correlation is a necessary reason to pair, not a sufficient one.
Some of my pairs are incomplete. Can I use the units with one measurement?
Not in this test. A pair with a missing half contributes no difference and is dropped, which is why paired designs should be sized with attrition built in — if you expect 10% of units to be lost between measurements, size for the pairs you need and then divide by 0.9. Discarding incomplete pairs is also only safe if the incompleteness is unrelated to the outcome. If units drop out because the change went badly for them, the surviving pairs are a biased sample and no test on them is valid.
Should I analyse the percentage change from baseline?
Usually not. Percentage change looks intuitive but is a poor outcome statistically: it is skewed by construction, undefined or explosive when the baseline is near zero, and it typically has lower power than either the raw difference or an analysis of the follow-up value with the baseline as a covariate. If baseline levels vary a lot across units and you want them accounted for, the covariate-adjusted analysis is the better tool, and it is the same idea variance-reduction techniques use.
My differences are skewed. Do I have to switch to a rank test?
Not automatically. With more than about 30 pairs the test is fairly robust to skew in the differences, because the assumption is about the sampling distribution of the mean difference rather than the differences themselves. The genuine trouble is a small number of pairs with a long tail, where one or two units set the result. There the options are the Wilcoxon signed-rank test, a bootstrap interval on the mean difference, or analysing a transformed outcome — chosen in advance, not after seeing which one gives the answer you like.

Related calculators

  • Two-sample t-test

    Compare the average of two independent groups — plan the sample size, then test the result.

  • Wilcoxon test

    Rank-sum (Mann-Whitney) and signed-rank tests, with the exact distribution for small samples.

  • McNemar's test

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

  • Equivalence: two means

    Show two averages are close enough to be interchangeable — set the margin, size the study, run both one-sided tests.

Terms on this page

  • CUPED

    Use pre-period data to strip out noise — the same test, 20-50% less traffic, no change to the estimate.

  • Difference-in-differences

    Subtract the untreated group's change from the treated group's — and everything rests on parallel trends.

  • Synthetic control

    Build the comparison group instead of finding one — the method for when you have one treated unit.

  • Geo experiment

    Randomise regions instead of users — the way to test marketing that cannot be hidden from a person.

  • Propensity score matching

    Pair like with like on the probability of being treated — and hope nothing important went unmeasured.

  • Standard deviation

    How spread out the data are, in the data's own units — and the reason some metrics need vastly more sample.

  • Normal distribution

    The bell curve — and why your skewed revenue data usually does not break the test anyway.

  • Outlier

    The extreme value that decides your result — and why the rule for handling it must precede the data.

Talk to the people who build these for a living

We build experiments that exploit the correlation you already have in your data, so a decision costs weeks rather than quarters. A/B Testing

References