Editverse Free Calculator
Non-Inferiority & Equivalence Test Calculator
Test whether a new treatment is not unacceptably worse than a comparator — set a margin, read the confidence interval against it — with the exact R command behind the result. A full interpretation guide follows below. Validated against R 4.3.3.
In Simple Words
A non-inferiority test asks a different question from the usual superiority test: not “is the new treatment better?” but “is it no worse than the standard by more than an acceptable margin?” That margin, set in advance, is the largest loss of efficacy you are willing to tolerate in exchange for other benefits such as lower cost or fewer side effects.
An equivalence test is stricter still: it requires the new treatment to be neither meaningfully worse nor meaningfully better, with the whole confidence interval falling inside a margin on both sides. In both designs the conclusion rests on where the confidence interval sits relative to the pre-specified margin, not on a p-value for a difference of zero.
When to Use Non-Inferiority and Equivalence Tests
Use a non-inferiority design when a new treatment is not expected to beat the standard on efficacy but offers other advantages, and you want to show it does not give up too much. Use an equivalence design — common in bioequivalence and biosimilar studies — when you must show two treatments are interchangeable within a margin.
The margin must be justified clinically and fixed before the data are seen; choosing it afterwards invalidates the test. Report the confidence interval relative to the margin and pre-register the design. For a conventional superiority comparison instead, see our odds ratio and p-value tools. Unsure which design fits? Our Test Selector can help.
e1 <- {e1}; n1 <- {n1}; e0 <- {e0}; n0 <- {n0}
margin <- {margin}/100
p1 <- e1/n1; p0 <- e0/n0
se <- sqrt(p1*(1-p1)/n1 + p0*(1-p0)/n0)
z <- (p1 - p0 + margin)/se # non-inferiority (higher is better)
c(diff = p1 - p0, z = z, p_one_sided = 1 - pnorm(z))
# Equivalence (TOST):
z2 <- (margin - (p1 - p0))/se
max(1 - pnorm(z), 1 - pnorm(z2)) # TOST p-valueUser guide
When to use. Show that a new treatment is not worse than control by more than a pre-specified margin (non-inferiority), or that two treatments differ by less than the margin in either direction (equivalence, TOST), for a binary outcome.
Assumptions. The margin was fixed in the protocol before data were seen and is justified clinically; large enough samples for the Wald approximation.
Common mistakes. Do not choose the margin after seeing the data. With small cells or rates near 0 or 100% use a score (Farrington-Manning) method. Non-significance in a superiority test is not evidence of equivalence.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Blackwelder WC. Proving the null hypothesis in clinical trials. Control Clin Trials. 1982;3:345-353.
- Schuirmann DJ. A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. J Pharmacokinet Biopharm. 1987;15:657-680.
- Piaggio G, et al. Reporting of noninferiority and equivalence randomized trials (CONSORT extension). JAMA. 2012;308(24):2594-2604.
Worked Examples
Example 1 — Non-inferiority met
A new drug’s difference from standard is −1.2% with a 95% confidence interval of −4.0% to +1.6%, and the pre-specified non-inferiority margin is 5%. Because the entire interval lies above −5%, the new drug is declared non-inferior: it does not lose more than the tolerable margin of efficacy.
Example 2 — Inconclusive result
If the same difference had a confidence interval of −6.5% to +0.5%, part of the interval falls below the −5% margin. Non-inferiority cannot be claimed — the data are consistent with an unacceptable loss of efficacy, even though the point estimate looks close.
Assumptions to Check
A pre-specified, justified margin. The non-inferiority or equivalence margin must be set before analysis on clinical grounds. A margin chosen to fit the result is not a valid test.
Assay sensitivity. The trial must be able to detect a difference if one exists; otherwise a sloppy study can look “non-inferior” simply because it was uninformative.
Analysis population. Intention-to-treat tends to dilute differences and can bias toward non-inferiority, so per-protocol analysis is usually reported alongside it.
Common Mistakes
Setting the margin after seeing the data
A margin chosen to make the result come out non-inferior is circular. It must be fixed and justified in the protocol before unblinding.
Confusing non-inferiority with equivalence
Non-inferiority is one-sided (no worse than); equivalence is two-sided (neither worse nor better). Reporting one as the other misstates the claim.
Relying on intention-to-treat alone
Because ITT can bias toward non-inferiority, regulators expect a per-protocol analysis to support the conclusion as well.
Reading a non-significant superiority test as non-inferiority
Failing to show superiority is not the same as showing non-inferiority. The latter requires the interval to sit above the margin, a separate, pre-planned analysis.
Frequently Asked Questions
What is the non-inferiority margin?
It is the largest acceptable loss of efficacy, set in advance on clinical grounds, below which the new treatment would be considered unacceptably worse.
How is this different from a superiority test?
Superiority asks whether the new treatment is better than control; non-inferiority asks whether it is not worse by more than the margin.
Why is per-protocol analysis emphasised here?
Intention-to-treat tends to make groups look more similar, which can bias toward non-inferiority, so per-protocol results are reported to guard against that.
Does the result match R and SAS?
Yes. The calculator compares the confidence interval to the margin using the standard approach and shows the R command so you can reproduce it.
Related Calculators
References
- Piaggio G, Elbourne DR, Pocock SJ, Evans SJW, Altman DG, et al. Reporting of noninferiority and equivalence randomized trials: extension of the CONSORT 2010 statement. JAMA. 2012;308(24):2594–2604. PMID 23268518.
- Schumi J, Wittes JT. Through the looking glass: understanding non-inferiority. Trials. 2011;12:106. PMID 21539749.
- U.S. Food and Drug Administration. Non-Inferiority Clinical Trials to Establish Effectiveness: Guidance for Industry. Silver Spring, MD: FDA; 2016.
Need This Analysis Done for Your Manuscript?
Our PhD biostatisticians design and analyse non-inferiority and equivalence trials — margin justification, sample size, and confidence-interval analysis — with reproducible R output.
