Skip to content

BCompare groups · Guide test 285

Paired TOST

Tests whether a paired mean difference lies within specified equivalence limits.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

In the app, set it up in Analyze with one of these methods:

In Equivalence and minimal-effect tests (TOST), choose Test = t tests (means). In Paired t-test, choose Lens = Equivalence (TOST).

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Paired TOST

30
0.10
0.8
0.50

Bounds at ± this margin, fixed before seeing the data (the smallest effect that would matter).

0.050

Your data

Drag a point or use ↑/↓ to change it
Before · n = 30 · mean 10.15After · n = 30 · mean 10.21

If H₀ were true

t = 2.39
  1. The reference: how t varies across samples when H₀ is true (the one-sided test that decides: min(t_L, −t_U), whose upper tail is max(p_L, p_U)).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .012).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The estimate against the bounds

L = −0.50 · p = .012U = 0.50 · p = .003

Bar: the 90% interval (1 − 2α), the TOST counterpart. Shaded: where the effect must lie to reject H₀. The whole interval sits inside the bounds: compatible with an effect too small to matter.

The formula

SE=sDn,tL=Dˉ−LSE, tU=Dˉ−USE,ν=n−1\mathrm{SE}=\frac{s_D}{\sqrt n},\quad t_L=\frac{\bar D-L}{\mathrm{SE}},\ t_U=\frac{\bar D-U}{\mathrm{SE}},\quad \nu=n-1

With your numbers

Dˉ=(−0.05), SE=0.19,tL=2.39, tU=(−2.93)\bar D = (-0.05),\ \mathrm{SE} = 0.19,\quad t_L = 2.39,\ t_U = (-2.93)
tL=(θ^−L)/SEt_L = (\hat\theta - L)/\mathrm{SE}
the test against the lower bound (upper tail)
tU=(θ^−U)/SEt_U = (\hat\theta - U)/\mathrm{SE}
the test against the upper bound (lower tail)
min⁡(tL,−tU)\min(t_L,-t_U)
the deciding test: its upper tail is max(p_L, p_U), the shaded area

The verdict

t(29) = 2.39, p = .012

p ≤ α = .050: reject H₀

Works on the within-pair differences, so stable person-to-person differences drop out. Bounds are on the mean change, in the measurement's units.

Statistic
2.391
p-value
0.0118
Paired TOST on Before: n = 30; After: n = 30: t(29) = 2.39, p = .012. The p-value is below α = .050, so the data are hard to reconcile with H0.

Paired TOST on Before: n = 30; After: n = 30: t(29) = 2.39, p = .012. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: mean paired change lies outside/on the equivalence interval.

Assumptions

Independent pairs; normal differences for exact small sample t inference; meaningful pairing and prespecified margins.

Formula

SE=sD/ntL=(Dˉ−L)/SEtU=(Dˉ−U)/SEν=n−1\begin{gathered}SE=s_D/\sqrt n\\[5pt] t_L=(\bar D-L)/SE\\[5pt] t_U=(\bar D-U)/SE\\[5pt]\nu=n-1\end{gathered}

Parameters and notation

Di=Xi−Yi; n complete pairs and sD their SD.

Structure of the method

Reduce each valid pair to its within-pair difference, estimate the difference mean and standard error, and apply one-sample t boundary tests at L and U. Pairing is incorporated before inference; treating the two measurements as independent discards the covariance and changes the uncertainty.

Estimated and nuisance parameters

The estimated effect is the mean paired change, with nuisance SD of differences and n−1 degrees of freedom. Within-pair correlation is already reflected in the difference variance when raw pairs are available. The acceptable mean-bias limits are fixed design choices, not fitted model coefficients.

Settings and design choices

Prespecify pair definitions, subtraction direction, equivalence margins and missing-pair policy. If only summary data are supplied, the within-pair correlation is needed to recover the difference variance. Keep bounds on the same raw or explicitly standardized scale used by the test.

Fitting and adaptation

Fit the difference model and examine the matching confidence interval. For repeated observations beyond one pair per subject, use a model that preserves subject dependence rather than multiplying the nominal n. Adaptation means selecting an appropriate sampling model and calibration, not optimizing the margin after analysis.

Sensitivity and robustness

Outlying differences and asymmetric heavy tails matter more than the marginal shape of either measurement alone. High correlation can improve precision but does not establish individual interchangeability. A near-zero equivalent mean bias may coexist with wide person-level disagreement; inspect limits of agreement and clinically relevant variability separately.

How to use and calibrate

Use paired TOST with both one-sided t tests rejecting, or the matching confidence interval contained in the limits.

Example application

Assess whether two measurement methods have acceptably small mean bias.

Interpretation and pitfalls

Watch out

Equivalence of average bias does not establish acceptable individual agreement; examine limits of agreement separately.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.

Python and R

Bounds −0.5 and +0.5 are prespecified in raw measurement units (around reference mean 5 for the one-sample example). Both one-sided p-values must be below .05; non-significance of an ordinary difference test is not equivalence.

Python · native

Validated — Executed successfully in the validation environment · needs numpy, scipy

import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
x = np.array([4.2,5.1,5.4,4.8,6.0,5.8,4.9,5.6,6.2,5.0])
y = np.array([4.0,4.4,4.8,5.0,5.1,4.3,4.7,4.6,5.2,4.9])
lo=-.5;hi=.5
a=stats.ttest_1samp(x-y,lo,alternative="greater");b=stats.ttest_1samp(x-y,hi,alternative="less")
p_tost=max(a.pvalue,b.pvalue);print(a.pvalue,b.pvalue,p_tost,p_tost<.05)
Output
4.5255552437941434e-05 0.7206799771000334 0.7206799771000334 False
R

Validated — Executed successfully in the validation environment · needs Base/standard library

x <- c(4.2,5.1,5.4,4.8,6.0,5.8,4.9,5.6,6.2,5.0)
y <- c(4.0,4.4,4.8,5.0,5.1,4.3,4.7,4.6,5.2,4.9)
lo<--.5;hi<-.5
a<-t.test(x-y,mu=lo,alternative="greater");b<-t.test(x-y,mu=hi,alternative="less")
print(c(p_lower=a$p.value,p_upper=b$p.value,p_TOST=max(a$p.value,b$p.value),equivalent=max(a$p.value,b$p.value)<.05))
Output
     p_lower      p_upper       p_TOST   equivalent 
4.525555e-05 7.206800e-01 7.206800e-01 0.000000e+00

Sources

Statistics guide v4 (historical):
R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 285, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT285.