Skip to content

Equivalence and minimum-effect tests

A non-significant test doesn't show two things are the same. Learn to show equivalence with TOST, test against a meaningful effect, and handle non-inferiority with Farrington–Manning.

Applied ~14 min10 steps

What runs in CodeSplash

You will be able to

  • Explain why a large p-value doesn't show equivalence
  • Run and read a TOST against a justified margin
  • Tell equivalence, minimum-effect and non-inferiority questions apart
  • Choose a TOST variant for the data

Read first

01

Not different is not the same

Read

A t test on ToothGrowth gives p = .061. Are the two supplements therefore equivalent?

No. A large p-value can come from a true null, a small effect, or a small sample. The test never tried to show sameness. To claim equivalence you have to say how different is different enough to matter, and then show the data exclude anything that large.

02

Two one-sided tests

Read

TOSTEquivalence testTests whether an effect is small enough to ignore, by rejecting effects beyond ± the SESOI. flips the null. It tests against the two edges of a margin ±Δ\pm\Delta:

H01: μ1−μ2≤−ΔH02: μ1−μ2≥+ΔH_{01}:\ \mu_1 - \mu_2 \le -\Delta \qquad H_{02}:\ \mu_1 - \mu_2 \ge +\Delta

If you reject both, the difference is inside the margin. The TOST p-value is the larger of the two. Equivalently, the 90% interval lies entirely within ±Δ\pm\Delta. It is 90% rather than 95% because each one-sided test spends 5%.

03

Move the margin

Explore

Set a small observed difference and move the margin. Then cut the sample size, and watch the ordinary test and TOST move in opposite directions.

BExplorable · Two one-sided tests

How do you show that two things are the same, not merely that you found no difference?

What can you conclude here?

How sure?
0.10
1.00
50
0.40
−margin+margin0

Inconclusive: neither test rejects

Equivalent when the whole 90% interval sits inside the margins. TOST p = .068; ordinary test p = .618.

Commit your prediction above to see the result

Make your prediction first; the figure appears when you commit.

Make your prediction to see the result.

Too little data can't show a difference, and can't show equivalence either. It leaves you uncertain.

04

Same data, a different verdict

Predict

Predict first

ToothGrowth: the difference is 3.70, and you set the margin at half a standard deviation, ±\pm3.74. The ordinary test wasn't significant. What does TOST say?

EquivalentNot shown equivalent
Reveal

not shown equivalent: its p is p = .492. The 90% interval is 0.47 to 6.93, which runs past the margin. Neither different nor equivalent: the honest word is inconclusive.

05

When equivalence holds

Read

Thirty-two measurements against a reference value, with a margin of ±\pm2. The mean difference is 0.0906, the 90% interval is −1.30 to 1.49, and the TOST gives p = .041.

Equivalence test (TOST, one-sample)Recorded · Python and R agreeRecorded 2026-11-25 · 27 values compared
R

TOST: t(31.00) = 1.96, p = .029; t(31.00) = −1.79, p = .041

mean minus the reference (mean of mpg − 20)
0.0906
p (TOST)
.041
80% CI
[−1.305, 1.486]
p (no difference)
.933

Plots

Estimate and 80% CI against the boundsHow large are several estimates, how precise, and which exclude the null?
View data
mpgCI highEstimateCI low
0.09061.486mean of mpg − 20−1.305

Assumptions

  • Normality — Shapiro–Wilk p ≥ .05.
  • Bounds set in advance — Bounds [-2, 2].

One-sided tests at the bounds

TestBoundtdfp
Lower (H0: effect ≤ lower bound)−21.96231.029
Upper (H0: effect ≥ upper bound)2−1.79231.041
No difference (two-sided)00.085131.933
  • Equivalence is concluded when both one-sided tests reject at α = 0.1, i.e. the 80% CI lies inside the bounds.
The exact R script · R R version 4.5.1 (2025-06-13)
# Equivalence and minimal-effect tests (TOST)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method equivalence.tost 1.1.1 · spec 95506fff8239a2f9
# Dataset: mtcars (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr)

# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/mtcars.parquet", col_select = c("mpg")))
n_input <- nrow(df)
df <- df[stats::complete.cases(df[c("mpg")]), , drop = FALSE]  # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
  warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("mpg"))  # infinite values stop the run (registry/errors.yaml)

# %% Estimate
y <- "mpg"
alpha <- 0.1
test <- "t"  # t | wilcoxon | brunner_munzel
hypothesis <- "equivalence"  # equivalence (TOST) | minimal_effect
direction <- "both"  # minimal effect: both | above | below
low <- -2
high <- 2
bound_type <- if (test == "t") "raw" else "raw"  # standardized bounds are for the t version only
mu <- 0
if (test == "brunner_munzel") stop("The Brunner–Munzel version compares two independent groups: bind Groups.")
x <- df[[y]]
mu <- 20
design <- "one-sample"
n <- length(x)
if (test == "t") {  # the t version needs a standard deviation
  if (n < 2) cs_error("CS_E_TOO_FEW_ROWS", what = "A one-sample equivalence test", min = 2, n = n)
  if (length(unique(x)) < 2) cs_error("CS_E_CONSTANT", column = y)
}
estimate <- mean(x) - mu
sd_used <- sd(x)
se <- sd_used / sqrt(n)
dof <- n - 1
samples <- list(x)
rank_x <- x
rank_y <- NULL
what <- if (test == "t") sprintf("mean of %s − %s", y, format(mu)) else sprintf("pseudo-median of %s − %s", y, format(mu))
estimand <- c(t = "mean minus the reference", wilcoxon = "pseudo-median minus the reference")[[test]]
if (test == "brunner_munzel") {
  low_raw <- 0.4
  high_raw <- 0.6
  if (!(0 <= low_raw && low_raw < high_raw && high_raw <= 1)) stop("Relative-effect bounds must satisfy 0 ≤ lower < upper ≤ 1 (e.g. 0.4 and 0.6)")
} else {
  if (low >= high) stop("The lower bound must be below the upper bound")
  bounds <- if (bound_type == "d") c(low, high) * sd_used else c(low, high)
  low_raw <- bounds[1]
  high_raw <- bounds[2]
}

# %% Test
stat_lower <- NULL
stat_upper <- NULL
stat_nhst <- NULL
exact <- NULL
t_lower <- NULL
t_upper <- NULL
t_nhst <- NULL
if (test == "t") {
  r <- cs_bounds_t(estimate, se, dof, low_raw, high_raw, alpha, hypothesis, direction)  # one-sided t tests at each bound
  t_lower <- r$t_lower
  t_upper <- r$t_upper
  t_nhst <- estimate / se
  p_nhst <- 2 * pt(abs(t_nhst), dof, lower.tail = FALSE)
} else if (test == "wilcoxon") {
  r <- cs_rank_tost(rank_x, rank_y, low_raw, high_raw, alpha, mu, "auto", TRUE,
                    hypothesis, direction)  # one-sided rank tests at each bound (wilcox.test)
  estimate <- r$estimate
  se <- NULL
  dof <- NULL
  sd_used <- NULL
  stat_lower <- r$stat_lower
  stat_upper <- r$stat_upper
  stat_nhst <- r$stat_nhst
  exact <- r$exact
  p_nhst <- r$p_nhst
} else {
  r <- cs_bm_tost(x1, x2, low_raw, high_raw, alpha, hypothesis, direction)  # Brunner-Munzel at each bound
  estimate <- r$estimate
  se <- r$se
  dof <- r$df
  sd_used <- NULL
  t_lower <- r$t_lower
  t_upper <- r$t_upper
  t_nhst <- r$stat_nhst
  p_nhst <- r$p_nhst
}
decision <- r$decision
name <- if (hypothesis == "equivalence") "TOST" else "minimal-effect test"
version <- c(t = "", wilcoxon = "Wilcoxon ", brunner_munzel = "Brunner–Munzel ")[[test]]

# %% Assumptions
assumptions <- list()
if (test == "t") {
  sw <- unlist(lapply(samples, function(s) if (length(s) >= 3 && length(s) <= 5000) shapiro.test(s)$p.value else NULL))
  bad <- sw[sw < 0.05]
  assumptions[[1]] <- list(key = "normality", label = "Normality",
                           status = if (length(bad)) (if (n < 30) "warn" else "info") else if (length(sw)) "pass" else "info",
                           detail = if (length(sw)) (if (length(bad)) sprintf("Shapiro–Wilk p < .05 in %d of %d sample(s); consider the Wilcoxon version.", length(bad), length(sw)) else "Shapiro–Wilk p ≥ .05.")
                                    else "Too few values for Shapiro–Wilk.")
} else if (test == "wilcoxon") {
  assumptions[[1]] <- list(key = "normality", label = "Shape", status = "info",
                           detail = if (design == "two-sample") "Rank-based: the groups share a shape (a pure shift)." else "Rank-based: the differences are symmetric about their center.")
} else {
  assumptions[[1]] <- list(key = "normality", label = "Shape", status = "info",
                           detail = "No distributional assumption: the bounds apply to the relative effect P(X > Y) + ½P(X = Y).")
}
assumptions[[2]] <- list(key = "bounds", label = "Bounds set in advance", status = "info",
                         detail = paste0(sprintf("Bounds [%s, %s]", format(signif(low_raw, 3)), format(signif(high_raw, 3))),
                                         if (bound_type == "d") sprintf(" (d = %s to %s × SD %s).", format(low), format(high), format(signif(sd_used, 3))) else "."))

# %% Result
level <- 1 - 2 * alpha
values <- list(estimate = estimate, se = se, df = dof, t_lower = t_lower, p_lower = r$p_lower, t_upper = t_upper, p_upper = r$p_upper,
               p = r$p, ci_low = r$ci_low, ci_high = r$ci_high, low_raw = low_raw, high_raw = high_raw,
               equivalent = decision == "equivalent", decision = decision, t_nhst = t_nhst, p_nhst = p_nhst, sd_used = sd_used,
               design = design, n = n, test = test, hypothesis = hypothesis, estimand = estimand,
               stat_lower = stat_lower, stat_upper = stat_upper, stat_nhst = stat_nhst, exact = exact)
values$missing_share <- if (n_input > 0) n_dropped / n_input else 0  # consult-a-statistician input
pct <- sprintf("%.0f%%", level * 100)
stat_label <- if (test == "wilcoxon") "W" else "t"
labels <- if (hypothesis == "equivalence") c("Lower (H0: effect ≤ lower bound)", "Upper (H0: effect ≥ upper bound)") else
  c("Below (H1: effect < lower bound)", "Above (H1: effect > upper bound)")
na_null <- function(v) if (is.null(v)) NA else v
rows <- list(
  list(test = labels[1], bound = low_raw, statistic = na_null(if (test == "wilcoxon") stat_lower else t_lower), df = na_null(dof), p = r$p_lower),
  list(test = labels[2], bound = high_raw, statistic = na_null(if (test == "wilcoxon") stat_upper else t_upper), df = na_null(dof), p = r$p_upper),
  list(test = if (test != "brunner_munzel") "No difference (two-sided)" else "Relative effect 0.5 (two-sided)",
       bound = if (test == "brunner_munzel") 0.5 else 0, statistic = na_null(if (test == "wilcoxon") stat_nhst else t_nhst), df = na_null(dof), p = p_nhst)
)
note <- if (hypothesis == "equivalence") {
  sprintf("Equivalence is concluded when both one-sided tests reject at α = %s, i.e. the %s CI lies inside the bounds.", format(alpha), pct)
} else {
  side <- c(both = "either", above = "the upper", below = "the lower")[[direction]]
  sprintf("A meaningful effect is concluded when %s outward one-sided test rejects at α = %s (the effect lies beyond the bound).", side, format(alpha))
}
if (test == "wilcoxon") {
  note <- paste0(note, sprintf(" Rank tests use the %s null distribution (as R's wilcox.test); the interval is the order-statistic interval for the %s.",
                               if (exact) "exact" else "normal-approximation", estimand))
}
verdict <- c(equivalent = "equivalent", `not shown equivalent` = "equivalence not shown", `meaningful effect` = "a meaningful effect",
             `not shown meaningful` = "a meaningful effect not shown")[[decision]]
cs_publish(list(
  method = "equivalence.tost",
  methodVersion = "1.1.1",
  title = if (hypothesis == "equivalence") sprintf("%sEquivalence test (TOST, %s)", version, design) else sprintf("%sMinimal-effect test (%s)", version, design),
  engine = cs_engine_info("stats", "nanoparquet"),
  n = n,
  summary = sprintf("%s: %s = %.3f, %s CI [%.3f, %.3f]; bounds [%.3f, %.3f]; %s (%s%s %s).", what, estimand, estimate, pct, r$ci_low, r$ci_high,
                    low_raw, high_raw, verdict, version, name, cs_fmt_p(r$p)),
  apa = if (test == "wilcoxon") sprintf("%s%s: W = %s, %s; W = %s, %s", version, name, cs_fmt_num(stat_lower), cs_fmt_p(r$p_lower),
                                        cs_fmt_num(stat_upper), cs_fmt_p(r$p_upper))
        else sprintf("%s%s: t(%s) = %s, %s; t(%s) = %s, %s", version, name, cs_fmt_num(dof), cs_fmt_num(t_lower), cs_fmt_p(r$p_lower),
                     cs_fmt_num(dof), cs_fmt_num(t_upper), cs_fmt_p(r$p_upper)),
  statistics = list(list(key = "estimate", label = sprintf("%s (%s)", estimand, what), value = estimate),
                    list(key = "p", label = sprintf("p (%s)", name), value = r$p, format = "p"),
                    list(key = "ci", label = paste(pct, "CI"), value = c(r$ci_low, r$ci_high)),
                    list(key = "p_nhst", label = "p (no difference)", value = p_nhst, format = "p")),
  tables = list(list(key = "tost", title = "One-sided tests at the bounds",
                     columns = list(list(key = "test", label = "Test", type = "string"), list(key = "bound", label = "Bound", type = "number"),
                                    list(key = "statistic", label = stat_label, type = "number"), list(key = "df", label = "df", type = "number"),
                                    list(key = "p", label = "p", type = "pvalue")),
                     rows = rows)),
  assumptions = assumptions,
  warnings = warnings,
  notes = list(note),
  values = values,
  charts = list(cs_chart("equivalence", "forest", sprintf("Estimate and %s CI against the bounds", pct), list(
    label = cs_col("Estimate", what, "categorical"), estimate = cs_col(y, estimate, "numeric"),
    low = cs_col("CI low", r$ci_low, "numeric"), high = cs_col("CI high", r$ci_high, "numeric")),
    controls = list(reference = if (test == "brunner_munzel") 0.5 else 0, bandLow = low_raw, bandHigh = high_raw)))
))
Python

TOST: t(31.00) = 1.96, p = .029; t(31.00) = −1.79, p = .041

mean minus the reference (mean of mpg − 20)
0.0906
p (TOST)
.041
80% CI
[−1.305, 1.486]
p (no difference)
.933

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • Normality — Shapiro–Wilk p ≥ .05.
  • Bounds set in advance — Bounds [-2, 2].

One-sided tests at the bounds

TestBoundtdfp
Lower (H0: effect ≤ lower bound)−21.96231.029
Upper (H0: effect ≥ upper bound)2−1.79231.041
No difference (two-sided)00.085131.933
  • Equivalence is concluded when both one-sided tests reject at α = 0.1, i.e. the 80% CI lies inside the bounds.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Equivalence and minimal-effect tests (TOST)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method equivalence.tost 1.1.1 · spec 95506fff8239a2f9
# Dataset: mtcars (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
import numpy as np
import pandas as pd
from scipy import stats

import codesplash as cs
from codesplash.stats import equivalence

# %% Data
df = pd.read_parquet("tests/parity/fixtures/mtcars.parquet", columns=["mpg"])
n_input = len(df)
df = df.dropna(subset=["mpg"])  # listwise deletion over the analysis columns
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
    warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
    cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["mpg"])  # infinite values stop the run (registry/errors.yaml)

# %% Estimate
y = "mpg"
alpha = 0.1
test = "t"  # t | wilcoxon | brunner_munzel
hypothesis = "equivalence"  # equivalence (TOST) | minimal_effect
direction = "both"  # minimal effect: both | above | below
low, high = -2, 2
bound_type = "raw" if test == "t" else "raw"  # standardized bounds are for the t version only
mu = 0.0
if test == "brunner_munzel":
    raise ValueError("The Brunner–Munzel version compares two independent groups: bind Groups.")
x = df[y].to_numpy(dtype=float)
mu = 20
design, n = "one-sample", len(x)
if test == "t":  # the t version needs a standard deviation
    if n < 2:
        cs.cs_error("CS_E_TOO_FEW_ROWS", what="A one-sample equivalence test", min=2, n=n)
    if len(np.unique(x)) < 2:
        cs.cs_error("CS_E_CONSTANT", column=y)
estimate, sd_used = x.mean() - mu, x.std(ddof=1)
se, dof = sd_used / np.sqrt(n), n - 1
samples, rank_x, rank_y = [x], x, None
what = f"mean of {y} − {mu:g}" if test == "t" else f"pseudo-median of {y} − {mu:g}"
estimand = {"t": "mean minus the reference", "wilcoxon": "pseudo-median minus the reference"}[test]
if test == "brunner_munzel":
    low_raw, high_raw = 0.4, 0.6
    if not 0 <= low_raw < high_raw <= 1:
        raise ValueError("Relative-effect bounds must satisfy 0 ≤ lower < upper ≤ 1 (e.g. 0.4 and 0.6)")
else:
    if low >= high:
        raise ValueError("The lower bound must be below the upper bound")
    low_raw, high_raw = (low * sd_used, high * sd_used) if bound_type == "d" else (low, high)

# %% Test
stat_lower = stat_upper = stat_nhst = exact = None
t_lower = t_upper = t_nhst = None
if test == "t":
    r = equivalence.bounds_t(estimate, se, dof, low_raw, high_raw, alpha, hypothesis, direction)  # one-sided t tests at each bound
    t_lower, t_upper = r["t_lower"], r["t_upper"]
    t_nhst = estimate / se
    p_nhst = float(2 * stats.t.sf(abs(t_nhst), dof))
elif test == "wilcoxon":
    r = equivalence.rank_tost(rank_x, rank_y, low_raw, high_raw, alpha, mu, "auto", True,
                              hypothesis, direction)  # one-sided rank tests at each bound (R wilcox.test)
    estimate, se, dof, sd_used = r["estimate"], None, None, None
    stat_lower, stat_upper, stat_nhst, exact = r["stat_lower"], r["stat_upper"], r["stat_nhst"], r["exact"]
    p_nhst = r["p_nhst"]
else:
    r = equivalence.bm_tost(x1, x2, low_raw, high_raw, alpha, hypothesis, direction)  # Brunner–Munzel at each bound
    estimate, se, dof, sd_used = r["estimate"], r["se"], r["df"], None
    t_lower, t_upper, t_nhst, p_nhst = r["t_lower"], r["t_upper"], r["stat_nhst"], r["p_nhst"]
decision = r["decision"]
name = "TOST" if hypothesis == "equivalence" else "minimal-effect test"
version = {"t": "", "wilcoxon": "Wilcoxon ", "brunner_munzel": "Brunner–Munzel "}[test]

# %% Assumptions
assumptions = []
if test == "t":
    sw = [stats.shapiro(s).pvalue for s in samples if 3 <= len(s) <= 5000]
    bad = [p for p in sw if p < 0.05]
    assumptions.append({"key": "normality", "label": "Normality", "status": ("warn" if n < 30 else "info") if bad else ("pass" if sw else "info"),
                        "detail": (f"Shapiro–Wilk p < .05 in {len(bad)} of {len(sw)} sample(s); consider the Wilcoxon version." if bad else "Shapiro–Wilk p ≥ .05.")
                        if sw else "Too few values for Shapiro–Wilk."})
elif test == "wilcoxon":
    assumptions.append({"key": "normality", "label": "Shape", "status": "info",
                        "detail": "Rank-based: the groups share a shape (a pure shift)." if design == "two-sample"
                        else "Rank-based: the differences are symmetric about their center."})
else:
    assumptions.append({"key": "normality", "label": "Shape", "status": "info",
                        "detail": "No distributional assumption: the bounds apply to the relative effect P(X > Y) + ½P(X = Y)."})
assumptions.append({"key": "bounds", "label": "Bounds set in advance", "status": "info",
                    "detail": f"Bounds [{low_raw:.3g}, {high_raw:.3g}]" + (f" (d = {low:g} to {high:g} × SD {sd_used:.3g})." if bound_type == "d" else ".")})

# %% Result
level = 1 - 2 * alpha
values = {"estimate": float(estimate), "se": None if se is None else float(se), "df": None if dof is None else float(dof),
          "t_lower": t_lower, "p_lower": r["p_lower"], "t_upper": t_upper, "p_upper": r["p_upper"], "p": r["p"],
          "ci_low": r["ci_low"], "ci_high": r["ci_high"], "low_raw": float(low_raw), "high_raw": float(high_raw),
          "equivalent": decision == "equivalent", "decision": decision, "t_nhst": None if t_nhst is None else float(t_nhst), "p_nhst": float(p_nhst),
          "sd_used": None if sd_used is None else float(sd_used), "design": design, "n": n, "test": test, "hypothesis": hypothesis,
          "estimand": estimand, "stat_lower": stat_lower, "stat_upper": stat_upper, "stat_nhst": stat_nhst, "exact": exact}
values["missing_share"] = n_dropped / n_input if n_input else 0.0  # consult-a-statistician input
stat_label = "W" if test == "wilcoxon" else "t"
if hypothesis == "equivalence":
    labels = ("Lower (H0: effect ≤ lower bound)", "Upper (H0: effect ≥ upper bound)")
else:
    labels = ("Below (H1: effect < lower bound)", "Above (H1: effect > upper bound)")
rows = [{"test": labels[0], "bound": float(low_raw), "statistic": stat_lower if test == "wilcoxon" else t_lower, "df": values["df"], "p": r["p_lower"]},
        {"test": labels[1], "bound": float(high_raw), "statistic": stat_upper if test == "wilcoxon" else t_upper, "df": values["df"], "p": r["p_upper"]},
        {"test": "No difference (two-sided)" if test != "brunner_munzel" else "Relative effect 0.5 (two-sided)",
         "bound": 0.5 if test == "brunner_munzel" else 0.0, "statistic": stat_nhst if test == "wilcoxon" else values["t_nhst"], "df": values["df"], "p": float(p_nhst)}]
if hypothesis == "equivalence":
    note = f"Equivalence is concluded when both one-sided tests reject at α = {alpha:g}, i.e. the {level:.0%} CI lies inside the bounds."
else:
    side = {"both": "either", "above": "the upper", "below": "the lower"}[direction]
    note = f"A meaningful effect is concluded when {side} outward one-sided test rejects at α = {alpha:g} (the effect lies beyond the bound)."
if test == "wilcoxon":
    note += f" Rank tests use the {'exact' if exact else 'normal-approximation'} null distribution (as R's wilcox.test); the interval is the order-statistic interval for the {estimand}."
verdict = {"equivalent": "equivalent", "not shown equivalent": "equivalence not shown", "meaningful effect": "a meaningful effect",
           "not shown meaningful": "a meaningful effect not shown"}[decision]
cs.publish({
    "method": "equivalence.tost",
    "methodVersion": "1.1.1",
    "title": f"{version}Equivalence test (TOST, {design})" if hypothesis == "equivalence" else f"{version}Minimal-effect test ({design})",
    "engine": cs.engine_info("pandas", "numpy", "scipy"),
    "n": n,
    "summary": f"{what}: {estimand} = {estimate:.3f}, {level:.0%} CI [{r['ci_low']:.3f}, {r['ci_high']:.3f}]; bounds [{low_raw:.3f}, {high_raw:.3f}]; "
               f"{verdict} ({version}{name} {cs.fmt_p(r['p'])}).",
    "apa": (f"{version}{name}: W = {cs.fmt_num(stat_lower)}, {cs.fmt_p(r['p_lower'])}; W = {cs.fmt_num(stat_upper)}, {cs.fmt_p(r['p_upper'])}"
            if test == "wilcoxon" else
            f"{version}{name}: t({cs.fmt_num(dof)}) = {cs.fmt_num(t_lower)}, {cs.fmt_p(r['p_lower'])}; t({cs.fmt_num(dof)}) = {cs.fmt_num(t_upper)}, {cs.fmt_p(r['p_upper'])}"),
    "statistics": [{"key": "estimate", "label": f"{estimand} ({what})", "value": float(estimate)},
                   {"key": "p", "label": f"p ({name})", "value": r["p"], "format": "p"},
                   {"key": "ci", "label": f"{level:.0%} CI", "value": [r["ci_low"], r["ci_high"]]},
                   {"key": "p_nhst", "label": "p (no difference)", "value": float(p_nhst), "format": "p"}],
    "tables": [{"key": "tost", "title": "One-sided tests at the bounds", "columns": [
        {"key": "test", "label": "Test", "type": "string"}, {"key": "bound", "label": "Bound", "type": "number"},
        {"key": "statistic", "label": stat_label, "type": "number"}, {"key": "df", "label": "df", "type": "number"}, {"key": "p", "label": "p", "type": "pvalue"}],
        "rows": rows}],
    "assumptions": assumptions,
    "warnings": warnings,
    "notes": [note],
    "values": values,
    "charts": [cs.chart("equivalence", "forest", f"Estimate and {level:.0%} CI against the bounds", {
        "label": cs.col("Estimate", [what], "categorical"), "estimate": cs.col(y, [float(estimate)], "numeric"),
        "low": cs.col("CI low", [r["ci_low"]], "numeric"), "high": cs.col("CI high", [r["ci_high"]], "numeric")},
        controls={"reference": 0.5 if test == "brunner_munzel" else 0, "bandLow": float(low_raw), "bandHigh": float(high_raw)})],
})

Now the claim is earned: effects as large as the margin are hard to reconcile with these data. The marginNon-inferiority marginThe largest loss you would accept and still call the new variant "not worse"; the test rejects H₀ (worse by the margin or more). must come first, because one chosen after seeing the data can make anything look equivalent. CodeSplash raises a flag asking you to justify it.

06

Significant, but does it matter?

Read

A minimum-effect test asks the reverse: is the effect bigger than the smallest one that matters?

Here the ordinary test has p = .019, so the difference isn't zero. Against a margin of ±\pm0.300, the minimum-effect test gives p = .104: not shown meaningful. The difference is real, and these data don't show it is big enough to care about.

07

Other shapes of the question

Read
Your questionTest
Student or Welch means, or pairedTOST on the t test family
Skewed outcome, ranksWilcoxon TOST
Not worse by more than a margin, proportionsFarrington–ManningFarrington–Manning testScore test that two proportions differ by a stated amount or ratio, with variance estimated at that null; used for non-inferiority.

A worked non-inferiority case: a margin of 0.100 on the risk difference gives p < .001.

On skewed data, a two-group Wilcoxon TOST gave p = .675, with the verdict not shown equivalent. The paired version uses signed ranks of the differences instead; they are different tests, so name the design.

08

Check your understanding

Checkpoint

Check yourself

A TOST gives one-sided p-values of .001 and .03. What is the TOST p-value?

Show the answer

Answer: 0.03

You must reject both one-sided nulls, so the larger p-value decides: .03.

Check yourself

The margin is ±2, the 95% interval is −1.9 to 1.7, and the 90% interval is −1.6 to 1.4. What do you conclude at α=.05\alpha = .05?

Show the answer

Answer: a

TOST at .05 uses the 90% interval. Containing zero has nothing to do with it.

Check yourself

A cheaper generic is acceptable unless it is worse by more than 3 points. It doesn't matter if it is better. Which question is this?

Show the answer

Answer: b

Only one direction matters, with a margin. Equivalence would also fail a generic that was much better.

Check yourself

A very large study finds a significant difference of 0.1 with a margin of ±1, and TOST also rejects. What do you report?

Show the answer

Answer: b

The ordinary test asks about zero and TOST asks about the margin. Both can reject, and that is the most informative outcome of all.

09

Use a lens or the method

In the app

Open the method directly, or add a lens to an ordinary t test, Mann–Whitney, Yuen, correlation or rate comparison. The lens keeps your test and adds the equivalence, minimal-effect or non-inferiority verdict to the same card.

10

Recap

Recap
  • A non-significant test doesn't show sameness; only a margin can make that claim testable.
  • TOST rejects both edges of the margin, which is the same as the 90% interval sitting inside it.
  • Minimum-effect tests ask whether an effect matters; non-inferiority asks whether something isn't worse.

Concepts in this lesson