Equivalence by two one-sided t tests, or non-inferiority by one, on a difference of means or a ratio of geometric means, version 2.0.1
stats-equivalence@2.0.1: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.
What this page can and cannot show
Level: Checked against a reference; statsmodels and SciPy; NIST StRD for the pooled SD and F only; Lakens' example matched only to its printed rounding. Reference kind: an outside program, statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; certified values, statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; the source's own worked example, Lakens 2017 worked example; SciPy for the bound, Soc Psychol Personal Sci 8:355-362; scipy 1.18.1; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, double precision; t tails from SciPy 1.18.1; the interval's t quantile from SciPy's isf at alpha 1e-9 and from mpmath at 60 digits at alpha 0.4999999; not an outside program.
Checked by this project, not independently reviewed. Every method on this page has its equations, constants, sources and cases on record, and its cases agree with the stated reference within the stated tolerance. A reader can follow each method's worked example by hand; that shows the stated method gives the stated answer for one set of inputs, and does not test the code. The other cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed them.
Every version of this method · Every method · What the levels mean
Version 2.0.1
Level: Checked against a reference; statsmodels and SciPy; NIST StRD for the pooled SD and F only; Lakens' example matched only to its printed rounding. Reference kind: an outside program, statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; certified values, statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; the source's own worked example, Lakens 2017 worked example; SciPy for the bound, Soc Psychol Personal Sci 8:355-362; scipy 1.18.1; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, double precision; t tails from SciPy 1.18.1; the interval's t quantile from SciPy's isf at alpha 1e-9 and from mpmath at 60 digits at alpha 0.4999999; not an outside program. stats-equivalence@2.0.1
Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.
Verification statement: Against statsmodels 0.15.0 and SciPy 1.18.1 on typed data (Student, Welch, paired, one-sample, log-ratio from values, non-inferiority in both directions; summaries for Student, Welch and paired). On NIST StRD AtmWtAg, the pooled SD agrees with the certified residual SD to LRE 11.2 and t² with the certified F to LRE 11.7. Lakens 2017's worked example is reproduced within the bound set by the rounding of its printed inputs; its printed t_U is recorded as a source anomaly.
From two independent groups (Student or Welch), paired values or one sample, as values or as n, mean and SD, the estimate, its standard error and degrees of freedom on a difference or log-ratio scale, then the shared two one-sided tests against the stated margins, the overall p, the (1 − 2α) interval and whether the hypothesis is shown at α.
- How results are reported: none: full double precision; every p is computed in its own tail
- Uncertainty: the (1 − 2α) t interval, d ± t(1 − α, df)·SE, back-transformed on the log-ratio scale; its coverage is not checked
- Computes through this project's own routines: the two-pass mean of each group or of the differences; the two-pass sample variance; rounding-level spread test of the differences or of each group (2·n·ε·M); the largest magnitude over the two value lists, the rounding bound's scale for the differences; the interval's t(1 − α, df), through the shared tost routine, taken from α itself (RAISE-F1)
- Reference, as its record states it: statsmodels 0.15.0 and SciPy 1.18.1 on typed data, NIST StRD AtmWtAg's residual SD and F, and Lakens 2017's printed example
- Computes through:
tost@2.0.1 - Level confirmed by this project's ruling of 17 November 2026
What this page can and cannot show
What was checked
41 cases in 4 files, linked by this exact version.
Run through the tool at build against an outside program, statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; certified values, statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; the source's own worked example, Lakens 2017 worked example; SciPy for the bound, Soc Psychol Personal Sci 8:355-362; scipy 1.18.1; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, double precision; t tails from SciPy 1.18.1; the interval's t quantile from SciPy's isf at alpha 1e-9 and from mpmath at 60 digits at alpha 0.4999999; not an outside program: 27 agree within the tolerance the file states, 14 refuse as the case expects, 0 differ, 0 were not run.
File 1, 29 cases
- Where the expected values came from: an outside program, statsmodels; NIST StRD AtmWtAg; SciPy statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1
- Recorded on: 2026-11-14
- Reference: statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; licence BSD-3-Clause
- Tolerance as the file states it: t, p, df, estimates, standard errors, pooled SDs and interval limits relative 1e-9 against statsmodels and SciPy; counts, statuses and codes exact
File 2, 7 cases
- Where the expected values came from: certified values, statsmodels; NIST StRD AtmWtAg; SciPy statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1
- Recorded on: 2026-11-14
- Reference: statsmodels; NIST StRD AtmWtAg; SciPy, statsmodels 0.15.0; StRD (data content 2003); scipy 1.18.1; licence BSD-3-Clause
- Tolerance as the file states it: AtmWtAg: pooled SD relative 1e-10 against NIST's certified residual SD (LRE >= 10); against statsmodels, each path at twice statsmodels' own measured relative error against a 50-digit evaluation of the same quantities (measured: t 1.1e-08, p 2.2e-08, df 1.1e-11, estimate 1.6e-09, standardError 6.2e-12, interval 2.8e-09), rounded up to one figure: t 3e-08, p 5e-08, df 3e-11, estimate 4e-09, standard error 2e-11, interval limits 6e-09; margins and level relative 1e-12; statuses and codes exact
File 3, 2 cases
- Where the expected values came from: the source's own worked example, Lakens 2017, section 'Equivalence Tests for Differences Between Two Independent Means', the organic-food example: t_L = 3.14, t_U = -2.69, df 182, p .001 and .004
- Recorded on: 2026-11-14
- Reference: Lakens 2017 worked example; SciPy for the bound, Soc Psychol Personal Sci 8:355-362; scipy 1.18.1; licence CC-BY-4.0
- Tolerance as the file states it: t absolute 0.099 and p absolute 0.0017, the effect of rounding the printed means and SDs (±0.005) plus half the printed digit; other values relative 1e-9 against SciPy and statsmodels; df, statuses and codes exact. Source anomaly: the printed t_U (-2.69) is -2.684 from the printed inputs.
File 4, 3 cases
- Where the expected values came from: an outside program, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only) 2026-11-14
- Recorded on: 2026-11-14
- Reference: second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14; licence BSD-3-Clause
- Tolerance as the file states it: t, p, df, estimates, standard errors and interval limits relative 1e-12; counts, statuses, codes and strings exact
Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.
What was not checked
Schuirmann 1987 and the FDA's 2001 guidance are not read; log-ratio analyses from summaries (of the logs or not) are not offered in 1.0.0; standardised (Cohen's d) margins are not offered, because they depend on the observed SD; the interval's coverage is not simulated; one-sample from summaries is not offered; crossover designs are pharmacokinetics' tool, through the same shared routine; the margins and α are the caller's.
Equations
Equation 1
d = mean, SE = s/√n, df = n − 1 (paired: on the within-pair differences)
one-sample: Lakens' t_L = (M − μ − Δ_L)/(SD/√N) is the test of the mean against the bound θ_L = μ + Δ_L, so the margins are bounds on the mean in the data's unit
| Symbol | Meaning and unit |
|---|---|
| d | estimate (in the caller's unit), as-given |
| s | sample SD (n − 1) (in the caller's unit), as-given |
| n | values or pairs |
| M, SD, N | Lakens' sample mean, SD and size: d, s and n here, as-given |
| μ | Lakens' reference value; with μ = 0 the bound θ_L is the margin itself, as-given |
| Δ_L | Lakens' lower equivalence bound relative to μ, as-given |
Source: Lakens D. Equivalence tests: a practical primer for t tests, correlations, and meta-analyses. Soc Psychol Personal Sci 2017;8(4):355-362 (CC BY 4.0), section the one-sample and dependent-means equations (t_L = (M − mu − Δ_L)/(SD/√N); the paired form on the differences), version of record, PMC full text (PMC5502906); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 0a9491b6f694. Free to read (CC BY 4.0), checked 2026-11-11. No erratum found (searched Europe PMC: the record's comment and correction list (PMID 28736600), Crossref: update and relation metadata for 10.1177/1948550617697177), 2026-11-11.
Equation 2
d = M₂ − M₁
s_p² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²)/(n₁ + n₂ − 2)
SE = s_p√(1/n₁ + 1/n₂)
df = n₁ + n₂ − 2
| Symbol | Meaning and unit |
|---|---|
| M | group mean (in the caller's unit); M₂ the named second group, M₁ the named first, as-given |
| s_p | pooled SD (in the caller's unit), as-given |
| n₁, n₂ | sizes of the first and second groups |
| s₁, s₂ | sample SDs (n − 1) of the first and second groups, as-given |
Source: Lakens D. Equivalence tests: a practical primer for t tests, correlations, and meta-analyses. Soc Psychol Personal Sci 2017;8(4):355-362 (CC BY 4.0), section equations 1 and 2, version of record, PMC full text (PMC5502906); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 0a9491b6f694. Free to read (CC BY 4.0), checked 2026-11-11. No erratum found (searched Europe PMC: the record's comment and correction list (PMID 28736600), Crossref: update and relation metadata for 10.1177/1948550617697177), 2026-11-11.
Equation 3
SE = √(s₁²/n₁ + s₂²/n₂)
df = (s₁²/n₁ + s₂²/n₂)² / ((s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1))
| Symbol | Meaning and unit |
|---|---|
| df | Welch–Satterthwaite degrees of freedom |
| n₁, n₂ | sizes of the first and second groups |
| s₁, s₂ | sample SDs (n − 1) of the first and second groups, as-given |
Source: Lakens D. Equivalence tests: a practical primer for t tests, correlations, and meta-analyses. Soc Psychol Personal Sci 2017;8(4):355-362 (CC BY 4.0), section equations 3 and 4, version of record, PMC full text (PMC5502906); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 0a9491b6f694. Free to read (CC BY 4.0), checked 2026-11-11. No erratum found (searched Europe PMC: the record's comment and correction list (PMID 28736600), Crossref: update and relation metadata for 10.1177/1948550617697177), 2026-11-11.
Equation 4
through the shared tost routine: t_L = (d − θ_L)/SE, p_L = P(T_df ≥ t_L)
t_U = (d − θ_U)/SE, p_U = P(T_df ≤ t_U). Equivalence: p = max(p_L, p_U), shown when p < α. Non-inferiority: better 'higher' tests the lower margin alone (side 'lower', H1: d > θ_L), better 'lower' the upper margin alone (side 'upper', H1: d < θ_U), shown when its p < α. Interval d ± t(1 − α, df)·SE at 1 − 2α. The reply's tests[].side is 'lower' or 'upper'
conclusion is 'shown' or 'not shown'
| Symbol | Meaning and unit |
|---|---|
| θ_L, θ_U | lower and upper margins on the analysis scale (in the caller's unit), as-given |
| SE | standard error (in the caller's unit), as-given |
| T_df | Student's t on df degrees of freedom |
| t(1 − α, df) | the 1 − α quantile of Student's t on df degrees of freedom |
| α | one-sided significance level |
Source: Lakens D. Equivalence tests: a practical primer for t tests, correlations, and meta-analyses. Soc Psychol Personal Sci 2017;8(4):355-362 (CC BY 4.0), section equations 1 and 2 and the one-sided tests of each bound; the conclusion rule and the interval are the shared tost record's, version of record, PMC full text (PMC5502906); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 0a9491b6f694. Free to read (CC BY 4.0), checked 2026-11-11. No erratum found (searched Europe PMC: the record's comment and correction list (PMID 28736600), Crossref: update and relation metadata for 10.1177/1948550617697177), 2026-11-11.
Equation 5
on the log-ratio scale every value is replaced by its natural log, the margins r by ln r
the estimate and interval limits are reported as exp of the analysis scale (a ratio of geometric means)
| Symbol | Meaning and unit |
|---|---|
| r | ratio margin |
Source: Lakens D. Equivalence tests: a practical primer for t tests, correlations, and meta-analyses. Soc Psychol Personal Sci 2017;8(4):355-362 (CC BY 4.0), section the TOST equations applied to the analysis scale; the log transform is the builder's construction, checked against statsmodels on logs, version of record, PMC full text (PMC5502906); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 0a9491b6f694. Free to read (CC BY 4.0), checked 2026-11-11. No erratum found (searched Europe PMC: the record's comment and correction list (PMID 28736600), Crossref: update and relation metadata for 10.1177/1948550617697177), 2026-11-11.
Conventions
What each mode computes:
hypothesis = equivalence: Two one-sided t tests against both margins; p = the larger one-sided p; shown when p < α, which is the (1 − 2α) interval lying inside the margins.hypothesis = non-inferiority: One one-sided t test against the one margin, on the side the stated direction of benefit gives; shown when its p < α.design = two-sample: Two independent groups: d = mean of the named second minus the named first, with Student's pooled or Welch's SE and df. The reply's n lists the group sizes in that order, [the named first, the named second], so for "A - B" it is [n of B, n of A] (F-6).design = paired: Pairs: d = mean of the within-pair differences, SE = s_d/√n, df = n − 1.design = one-sample: One sample: d = its mean, tested against margins in the data's unit; SE = s/√n, df = n − 1.scale = difference: A difference of means, in the data's unit; margins in the data's unit.scale = log-ratio: A ratio of geometric means (unit 1): the analysis on natural logs of positive values, margins as ratios; the SE on the log scale (ln(1)).
Constants
Constants: none used.
Worked example
Worked example: one case of stats-equivalence@2.0.1, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- hypothesis = equivalence
- design = two-sample
- scale = difference
- input = summary
- spread = sd
- margins.lower = -0.384
- margins.upper = 0.384
- alpha = 0.05
- groups[0].name = A
- groups[0].n = 89
- groups[0].mean = 5.22
- groups[0].sd = 0.83
- groups[1].name = B
- groups[1].n = 95
- groups[1].mean = 5.25
- groups[1].sd = 0.95
- variance = pooled
- difference = B - A
Steps
- d = 0.03, from groups[0].mean, groups[1].mean; by equation 2; gives estimate.
- sp = 0.89399154, from groups[0].sd, groups[1].sd, groups[0].n, groups[1].n; by equation 2.
- se = 0.131882, from sp, groups[0].n, groups[1].n; by equation 2; gives standardError.
- df = 182, from groups[0].n, groups[1].n; by equation 2; gives df.
The working, as the case writes it:
printed inputs reproduce t_L = 3.1392 (printed 3.14) and t_U = -2.6842, where the source prints -2.69: the method gives -2.684, outside the printed value's rounding, so the printed t_U is a source anomaly
rounding of the inputs moves t by up to 0.0939 and p by up to 0.00116
Answer
estimate= 0.03standardError= 0.131882df= 182
Where these values came from: the source's own worked example, Lakens 2017, section 'Equivalence Tests for Differences Between Two Independent Means', the organic-food example: t_L = 3.14, t_U = -2.69, df 182, p .001 and .004; Lakens 2017, the organic-food example (printed values).
At build the tool returned this answer within the tolerance the file states: t absolute 0.099 and p absolute 0.0017, the effect of rounding the printed means and SDs (±0.005) plus half the printed digit; other values relative 1e-9 against SciPy and statsmodels; df, statuses and codes exact. Source anomaly: the printed t_U (-2.69) is -2.684 from the printed inputs.
Who worked this case: not recorded.
What it refuses, and its input ranges
MARGINS_ORDER: equivalence with the lower margin not below the upper Next: Give a lower margin below the upper margin.MARGINS_NOT_STRADDLING: two-sample and paired designs: equivalence margins that do not lie either side of no difference (0, or a ratio of 1); a one-sample test takes bounds on the mean in the data's unit Next: Give margins either side of no difference (0, or a ratio of 1), or use a one-sample test against bounds.SAMPLE_TOO_SMALL: fewer than 3 values in a group, or 3 pairs (the rule the suite's t tests hold) Next: Give at least three values per group, or three pairs.ZERO_VARIANCE: a group, or the differences, with no spread beyond rounding (max − min within 2·n·ε·M, M the largest magnitude among the values; from summaries, an SD of zero): t is undefined Next: No change of input makes this computable on these data.NONPOSITIVE_VALUES: a value at or below 0 on the log-ratio scale Next: Use the difference scale, or give values above 0.LOG_SUMMARY_NOT_ON_LOGS: any log-ratio analysis from summaries; this version has no input for summaries of the logs Next: Give the raw values for a log-ratio analysis, or use the difference scale with summaries.PAIRED_NEEDS_DIFFERENCES: a paired analysis from the two groups' own summaries, which do not give the SD of the differences Next: Give the mean and SD of the within-pair differences, or the paired values themselves.MARGIN_SIDE(invalid input): two-sample and paired designs: a non-inferiority margin on the wrong side of no difference for the stated direction of benefit, or at it: better 'higher' needs a margin below 0 (a ratio below 1) and better 'lower' one above 0 (a ratio above 1), so a margin of exactly 0 (or 1) is refused (F-6)PAIRS_UNEQUAL(invalid input): paired values a and b of different lengths
Changes
No correction is logged for stats-equivalence@2.0.1.
Tools that use it
Cite this version
Equivalence by two one-sided t tests, or non-inferiority by one, on a difference of means or a ratio of geometric means. Drybench; stats-equivalence@2.0.1; https://www.drybench.com/methods/m/stats-equivalence/2.0.1 (accessed [date]).