BCompare groups · Guide test 286
Wilcoxon TOST
Uses rank based one sided tests to assess equivalence for a specified location effect under its assumptions.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Equivalence and minimal-effect tests (TOST) — Is an effect small enough to be practically equivalent to zero, or large enough to matter?
In Equivalence and minimal-effect tests (TOST), choose Test = Wilcoxon (ranks).
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 · Wilcoxon 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 z varies across samples when H₀ is true (normal approximation with tie and continuity corrections; the deciding one-sided test, min(z_L, −z_U)).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .036).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The estimate against the bounds
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
With your numbers
- the rank-sum statistic after shifting group 1 by the bound
- normal approximations with tie and continuity corrections
- Hodges–Lehmann shift estimate
The verdict
z = 1.79, p = .036
p ≤ α = .050: reject H₀
A location-shift equivalence test: it reads as one only when both groups share a shape. It is not an equivalence test for the means. The bench shows the two-group (rank-sum) version, like the guide's code; the guide's formula is the paired (signed-rank) version. CodeSplash runs both: give a group column for the rank-sum version, or a second measurement for the signed-rank version.
- Statistic
- 1.795
- p-value
- 0.0364
Wilcoxon TOST on Group 1: n = 40; Group 2: n = 40: z = 1.79, p = .036. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: a rank-based location/shift parameter lies outside/on equivalence bounds.
Assumptions
Independent pairs with symmetric differences for signed-rank location inference, or independent groups under a common-shape shift model for rank-sum inference; bounds specified in the same parameter scale.
Formula
Parameters and notation
Displayed paired signed-rank version; for independent groups shift one group by each boundary and apply one-sided rank-sum tests.
Structure of the method
Apply a one-sided Wilcoxon-family test at each shift boundary and take the maximum p value. Paired data use signed ranks of shifted differences; independent groups use rank sums after shifting one sample. These are different designs with different assumptions despite sharing the TOST decision structure.
Estimated and nuisance parameters
Ranks, signed-rank or Mann–Whitney statistics and any associated location/pseudomedian estimate are data-derived. Bounds specify the target shift in measurement units. A rank test is not automatically a test of the raw mean, nor an arbitrary difference in medians without additional shape assumptions.
Settings and design choices
Specify paired versus independent design, shift margins, tie/zero handling, continuity correction and exact versus asymptotic inference. The existing code demonstrates the independent rank-sum version even though the displayed formula uses paired differences. The TOSTER implementation documented here uses a normal approximation and continuity correction.
Fitting and adaptation
There is no neural tuning. Fit the prespecified rank-based comparison and report both boundary p values. If an exact implementation cannot handle ties or zeros as required, choose and justify a supported calibration; do not label an asymptotic result exact. Maintain the same shift definition in sensitivity analyses.
Sensitivity and robustness
Asymmetry of paired differences undermines the signed-rank location interpretation; unequal distribution shapes complicate independent shift interpretation. Rounded values create ties and can alter attainable p values. Equivalence conclusions depend on the parameter and margins, so describe the inferred shift rather than claiming all aspects of the distributions are equivalent.
How to use and calibrate
Reject both boundary nulls at α using the appropriate exact/asymptotic rank tests; state paired versus independent and tie handling.
Example application
Assess equivalence of a symmetric nonnormal paired location shift.
Interpretation and pitfalls
Watch out
Wilcoxon procedures generally concern a shift/pseudomedian or relative effect, not an arbitrary difference of population medians or means.
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.
- Rewritten in the review: example application.
Example applicationsearch.r-project.org
The original application mentions paired data while the actual R and Python examples are independent-sample tests.
Corrected text
Assess equivalence of a rank-based location shift. The displayed formula illustrates paired signed-rank TOST, whereas both supplied code examples use the independent two-sample Wilcoxon–Mann–Whitney version. Choose the design and its assumptions explicitly.
Python and R
Independent-sample rank TOST with a location-shift interpretation only under common distribution shape; it is not automatically an equivalence test for arithmetic means.
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])
a=stats.mannwhitneyu(x+.5,y,alternative="greater",method="asymptotic");b=stats.mannwhitneyu(x-.5,y,alternative="less",method="asymptotic")
print(a.pvalue,b.pvalue,max(a.pvalue,b.pvalue))
Output
0.00043839901482793707 0.6752339604167513 0.6752339604167513
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<-wilcox.test(x,y,mu=lo,alternative="greater",exact=FALSE);b<-wilcox.test(x,y,mu=hi,alternative="less",exact=FALSE);print(c(p_lower=a$p.value,p_upper=b$p.value,p_TOST=max(a$p.value,b$p.value)))
Output
p_lower p_upper p_TOST 0.000438399 0.675233960 0.675233960
Sources
- TOSTER — TOSTER · wilcox_TOSTAuthor documentation/source reviewed: TOSTER 0.8.6.search.r-project.org
- wilcox_TOSTsearch.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 286, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT286.