Skip to content

BCompare groups · Guide test 284

Welch TOST

Applies the two one sided equivalence procedure to independent means with unequal variances.

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 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

40
40
0.10
1.0
1.0
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
Group 1 · n = 40 · mean 0.24Group 2 · n = 40 · mean 0.02

If H₀ were true

t = 1.21
  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 = .114).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The estimate against the bounds

L = −0.50 · p = .002U = 0.50 · p = .114

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

SE=s12n1+s22n2,tL=xˉ1−xˉ2−LSE, tU=xˉ1−xˉ2−USE\mathrm{SE}=\sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}},\quad t_L=\frac{\bar x_1-\bar x_2-L}{\mathrm{SE}},\ t_U=\frac{\bar x_1-\bar x_2-U}{\mathrm{SE}}

With your numbers

xˉ1−xˉ2=0.21, SE=0.24,tL=2.99, tU=(−1.21),ν=78.00\bar x_1-\bar x_2 = 0.21,\ \mathrm{SE} = 0.24,\quad t_L = 2.99,\ t_U = (-1.21),\quad \nu = 78.00
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(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 H0.

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

SE=s12/n1+s22/n2tL=(xˉ1−xˉ2−L)/SEtU=(xˉ1−xˉ2−U)/SE\begin{gathered}SE=\sqrt{s_1^2/n_1+s_2^2/n_2}\\[5pt] t_L=(\bar x_1-\bar x_2-L)/SE\\[5pt] t_U=(\bar x_1-\bar x_2-U)/SE\end{gathered}

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.

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_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
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",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

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.