Skip to content

Paired t-test

A paired t-test checks the mean difference within matched observations. Work through execution-cost savings, the exact t model and the design errors that distort uncertainty.

A paired t-test tests a claim about the population mean of the differences between matched observations. It is a one-sample Student’s t-test applied to those differences. For a quant comparing two execution algorithms on the same market scenarios, the relevant observation is each scenario’s cost saving, rather than two unrelated lists of costs.
Pairing preserves a common context: the same trading day, instrument, customer or experimental unit. Dependence within a pair is allowed. The usual exact test requires the differences to be independent and identically normally distributed across pairs. Normality is a condition on the differences, not a requirement that the two cost series each pass separate normality tests.

Turn two measurements into one observation

Choose the subtraction order before interpreting the result. Write

Di=Ai−Bi,μD=E[Di].D_i=A_i-B_i,\qquad \mu_D=\mathbb{E}[D_i].
If AiA_i and BiB_i are execution costs, a positive difference means B is cheaper. The null hypothesis can specify any benchmark δ0\delta_0, with zero representing no mean saving:
H0:μD=δ0,H1:μD≠δ0.H_0:\mu_D=\delta_0,\qquad H_1:\mu_D\ne\delta_0.
For nn complete pairs, compute the sample mean and sample standard deviation of the differences:
Dˉ=1n∑i=1nDi,sD2=1n−1∑i=1n(Di−Dˉ)2.\bar D=\frac{1}{n}\sum_{i=1}^{n}D_i, \qquad s_D^2=\frac{1}{n-1}\sum_{i=1}^{n}(D_i-\bar D)^2.
The standard error is sD/ns_D/\sqrt n, giving
T=Dˉ−δ0sD/n.T=\frac{\bar D-\delta_0}{s_D/\sqrt n}.
Under H0H_0, iid normal differences with positive population variance give a Student’s t-distribution with n−1n-1 degrees of freedom. There are nn observations for inference, because each pair supplies one difference. With fewer than two pairs, or zero observed difference variance, this ordinary statistic is undefined.
For a two-sided test, the p-value is the probability, under the null model, of a t statistic at least as large in absolute value as the observed one. A one-sided alternative is also possible, but its direction must be chosen before inspecting the results.

Six matched execution scenarios

Consider these hypothetical costs, measured in basis points of traded notional. The pairing is fixed by scenario identity; the numbers illustrate the calculation rather than establish a real trading advantage.
ScenarioA cost (bp)B cost (bp)Saving A − B (bp)
1220
2321
3211
4532
5422
6633

The six differences have mean 1.51.5 bp and sample variance 1.1 bp21.1\ \text{bp}^2. Therefore,

SE=1.16≈0.4282 bp,T=1.5−00.4281744≈3.503.\text{SE}=\sqrt{\frac{1.1}{6}}\approx0.4282\ \text{bp}, \qquad T=\frac{1.5-0}{0.4281744}\approx3.503.
Using five degrees of freedom, the two-sided p-value is approximately 0.01720.0172. A prespecified test rejecting when p<0.05p<0.05 rejects the zero-mean null under the stated model. The matching 95% confidence interval for the mean saving is
Dˉ±t0.975,5sD6=1.5±2.57058(0.4281744)≈[0.399, 2.601] bp,\bar D\pm t_{0.975,5}\frac{s_D}{\sqrt6} =1.5\pm2.57058(0.4281744) \approx[0.399,\ 2.601]\ \text{bp},
where t0.975,5t_{0.975,5} denotes the 97.5th percentile. This interval excludes zero and reports the size and uncertainty of the estimated saving. It is an interval for the population mean saving, not a guarantee that B saves money in each new scenario. Six observations provide little information with which to assess the distributional assumption; the attractive p-value does not validate that assumption.
Six hypothetical scenarios pair A costs 2, 3, 2, 5, 4, 6 bp with B costs 2, 2, 1, 3, 2, 3 bp. Differences are 0, 1, 1, 2, 2, 3 bp, with mean 1.5 bp and 95% t interval 0.399 to 2.601 bp.
Six hypothetical scenarios pair A costs 2, 3, 2, 5, 4, 6 bp with B costs 2, 2, 1, 3, 2, 3 bp. Differences are 0, 1, 1, 2, 2, 3 bp, with mean 1.5 bp and 95% t interval 0.399 to 2.601 bp.
Original hypothetical matched-cost example. The left panel preserves scenario identity; the right panel isolates savings. The lower interval uses six iid normal differences as the inference model.

Why matching can improve precision

Within-pair covariance enters the variance of a difference:
Var(Ai−Bi)=Var(Ai)+Var(Bi)−2Cov(Ai,Bi).\text{Var}(A_i-B_i) =\text{Var}(A_i)+\text{Var}(B_i)-2\text{Cov}(A_i,B_i).

When both algorithms face unusually difficult conditions in the same scenario, their costs may rise together. Positive covariance can cancel part of that shared noise when costs are subtracted. Negative covariance instead increases difference variance. Positive correlation is a potential precision benefit, not a validity requirement for the paired test.

For the paired-interval derivation and the variance comparison with an independent-sample design, see the paired-sample section of Two-Sample Tests and Intervals (public preview; full lesson requires membership).

Preserve the design, not just the row count

  • Keep the real match. Sorting A and B separately before subtracting destroys the scenario match and can manufacture an artificially small difference variance. Reordering matched rows together is harmless. Any complete one-to-one re-pairing preserves Aˉ−Bˉ\bar A-\bar B; it can still change sDs_D, the statistic and the p-value. A fixed, data-independent pairing of genuinely independent iid normal samples can produce a valid one-sample t test on differences, but supplies no covariance benefit.
  • Check dependence across pairs. Pairing two strategies by trading day preserves their same-day relationship; it does not remove autocorrelation across days. Overlapping returns or repeated orders within the same market event can invalidate sD/ns_D/\sqrt n. The uncertainty calculation then needs a method suited to that dependence.
  • Check the difference series. Outliers and heavy tails matter, especially with few pairs. Under suitable finite-variance conditions, large-sample inference can be approximately valid without normality; there is no universal pair count that repairs arbitrary skewness, dependence or tail behaviour.
  • Separate mean evidence from a deployment decision. Statistical significance does not establish causality, stability after strategy selection, or savings large enough to cover switching costs. A before/after pairing can still confound a system change with a market-regime change.

Sources

Last updated
  • paired data
  • mean difference
  • student t
  • execution costs
  • statistical inference
← Back to the glossaryBack to top ↑