BCompare groups · Guide test 284
Welch TOST
Applies the two one sided equivalence procedure to independent means with unequal variances.
Do it in CodeSplash
In the app, set it up in Analyze with one of these methods:
- Equivalence and minimal-effect tests (TOST) — Is an effect small enough to be practically equivalent to zero, or large enough to matter?
- Two-sample t-test (Welch / Student, or z test) — Do two independent groups differ in their mean?
In Equivalence and minimal-effect tests (TOST), choose Test = t tests (means). In Two-sample t-test (Welch / Student, or z 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 · Welch TOST
Bounds at ± this margin, fixed before seeing the data (the smallest effect that would matter).
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- 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)).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .114).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The estimate against the bounds
Bar: the 90% interval (1 − 2α), the TOST counterpart. Shaded: where the effect must lie to reject H₀. The interval reaches past a bound: equivalence is not shown (which is not evidence of a difference).
The formula
With your numbers
- the test against the lower bound (upper tail)
- the test against the upper bound (lower tail)
- the deciding test: its upper tail is max(p_L, p_U), the shaded area
The verdict
t(78.00) = 1.21, p = .114
p > α = .050: compatible with H₀
Welch's SE and df, so unequal spreads are fine. With small groups the interval is wide and equivalence is hard to show: that is the test being honest, not failing.
- Statistic
- 1.215
- p-value
- 0.1140
Welch TOST on Group 1: n = 40; Group 2: n = 40: t(78.00) = 1.21, p = .114. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: μ1−μ2 lies outside or on equivalence limits; H1: it lies strictly inside.
Assumptions
Independent groups, valid mean inference and unequal-variance Welch approximation; prespecified bounds.
Formula
Parameters and notation
Use Welch–Satterthwaite ν from entry 11; L,U are in the difference’s measurement units.
Structure of the method
Estimate the independent-group mean difference and unequal-variance standard error, compute Welch–Satterthwaite degrees of freedom, then test the lower and upper equivalence boundaries separately. Both tests use the same model-specific uncertainty and must reject to establish the prespecified equivalence claim.
Estimated and nuisance parameters
The two means, two sample variances, difference and approximate degrees of freedom are data-derived. Group sample sizes are design quantities; equivalence margins remain fixed scientific inputs. Welch inference estimates separate variances and does not pool them merely to make the bounds easier to meet.
Settings and design choices
Choose the measurement scale, margins, alpha, allocation and treatment of missing observations in advance. Unequal group sizes affect precision most when paired with unequal variances. State whether the confidence interval is the matching 1−2alpha Welch interval, not an ordinary 95% interval used inconsistently.
Fitting and adaptation
Fit the two-group model once and evaluate both boundary statistics. Adaptation to covariates or clusters requires a regression/robust-equivalence procedure with its own standard error; it is not neural fine-tuning. Power planning should vary variance ratios and plausible true differences rather than assume exact equality automatically.
Sensitivity and robustness
Small samples, heavy tails and extreme outliers can undermine the Welch approximation. A significant difference from zero can coexist with equivalence when it is precise and lies within the margins. Conversely, nonsignificance for zero difference can coexist with failure of equivalence. Report estimates, intervals, both boundary p values and sample sizes.
How to use and calibrate
Apply both one-sided Welch t tests at α, or check the corresponding 1−2α interval.
Example application
Establish practical equivalence of two independent treatment means.
Interpretation and pitfalls
Watch out
Small samples, extreme outliers and post hoc bounds undermine conclusions. Statistical equivalence is defined relative to the chosen margin.
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.
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_ind(x-lo,y,equal_var=False,alternative="greater");b=stats.ttest_ind(x-hi,y,equal_var=False,alternative="less")
p_tost=max(a.pvalue,b.pvalue);print(a.pvalue,b.pvalue,p_tost,p_tost<.05)
Output
0.00011378501360759757 0.6660433761705717 0.6660433761705717 False
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",var.equal=FALSE);b<-t.test(x,y,mu=hi,alternative="less",var.equal=FALSE)
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 0.000113785 0.666043376 0.666043376 0.000000000
Sources
- TOSTER — TOSTER · TOSTtwoAuthor documentation/source reviewed: TOSTER 0.8.6.search.r-project.org
- TOSTtwosearch.r-project.org
- 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 284, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT284.