Hypothesis tests

Online non-inferiority & equivalence test calculator

Assess whether a treatment is non-inferior, non-superior or equivalent to a control, using a predefined margin δ, for means or proportions.

Parameters

Select the test type and variable, enter the data and the margin δ to get the z statistics, p-value, decision and confidence interval.

Result pending…

Decision zones of the test

What are non-inferiority and equivalence tests?

In a classic test you try to show that two treatments are different. But often the question is the opposite: is the generic as effective as the brand-name drug? Does a less invasive surgery, a cheaper treatment or a new version of a process work just as well? A classic test cannot answer that, because not rejecting \(H_0\) does not prove that the treatments are equal: it may simply be due to a small sample.

Non-inferiority and equivalence tests reverse the burden of proof. The null hypothesis becomes that there is a relevant difference, and what the data have to show is that the difference is small. For that you need to set a margin \(\delta\) in advance: the largest difference that would be considered irrelevant in practice.

  • Non-inferiority: showing that the new treatment is not worse than the control by more than \(\delta\). It is a one-tailed test. It is used, for example, when the new treatment has other advantages (price, convenience, fewer side effects) and it is enough that it does not lose a relevant amount of efficacy.
  • Non-superiority: the mirror image, showing that it is not better by more than \(\delta\). It is useful, for example, to show that a side effect does not increase by a relevant amount.
  • Equivalence: showing that it is neither worse nor better by more than \(\delta\). Both one-tailed tests are run at once, the TOST procedure (two one-sided tests). This is the approach of bioequivalence studies and of comparisons between measurement methods.

In all cases, \(\Delta = \theta_1 - \theta_2\) is the difference between the treatment (group 1) and the control (group 2), in means or proportions, and positive values of \(\Delta\) favour the treatment.

Hypotheses and test statistics

Let \(\hat{\Delta} = \hat{\theta}_1 - \hat{\theta}_2\) be the observed difference and \(SE\) its standard error:

\( \hat{\Delta} = \bar{x}_1 - \bar{x}_2, \qquad SE = \sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}} \quad \text{(means)} \)

\( \hat{\Delta} = \hat{p}_1 - \hat{p}_2, \qquad SE = \sqrt{\dfrac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \dfrac{\hat{p}_2(1-\hat{p}_2)}{n_2}} \quad \text{(proportions)} \)

Test\(H_0\)\(H_1\)Statistic
Non-inferiority\(\Delta \leq -\delta\)\(\Delta > -\delta\)\(z_1 = (\hat{\Delta} + \delta)/SE\)
Non-superiority\(\Delta \geq +\delta\)\(\Delta < +\delta\)\(z_2 = (\delta - \hat{\Delta})/SE\)
Equivalence (TOST)\(|\Delta| \geq \delta\)\(-\delta < \Delta < +\delta\)\(z_1\) and \(z_2\)

Each one-tailed test has p-value \(p = 1 - \Phi(z)\), where \(\Phi\) is the cumulative distribution function of the standard normal. In TOST, \(H_0\) is rejected only if both tests reject, so its p-value is the larger of the two: \(p_{\text{TOST}} = \max(p_1, p_2)\). The calculator uses the normal approximation, which is appropriate with the moderate or large samples usual in this kind of study.

The confidence interval rule

The clearest way to understand these tests is through the confidence interval for the difference at the \(100(1-2\alpha)\%\) level. With \(\alpha = 0.05\), that is the 90% interval:

  • Non-inferiority: declared if the lower limit of the interval lies above \(-\delta\).
  • Non-superiority: if the upper limit lies below \(+\delta\).
  • Equivalence: if the whole interval fits within \([-\delta, +\delta]\).

Why 90% and not 95%? Because each one-tailed test uses \(\alpha = 0.05\) in a single tail, and a 90% interval leaves exactly 5% in each tail. Regulatory guidelines for clinical trials (ICH E9, EMA, FDA) usually require \(\alpha = 0.025\) per tail, which amounts to checking the 95% interval; if you work in that setting, enter 0.025 in the calculator.

This approach also clarifies the possible outcomes. An interval can lie entirely above \(-\delta\) (non-inferior), cross \(-\delta\) (inconclusive) or even lie entirely above 0 (non-inferior and also superior). What it never allows is concluding equivalence just because the interval contains 0.

How to choose the margin δ

The margin is the most important design decision and must be set before seeing the data, on clinical, technical or business grounds, not statistical ones. Some common guidelines:

  • In clinical trials against an active control, the margin is usually a fraction (for example, half) of the effect the control has shown against placebo, to ensure that the new treatment retains a good part of that effect.
  • In drug bioequivalence, the standard is that the ratio of geometric means lies between 0.80 and 1.25, which on the log scale is a symmetric margin.
  • When comparing methods or processes, the margin is the difference that would not change any technical decision.

A margin that is too wide lets almost any treatment "show" non-inferiority; one that is too narrow requires huge samples. Changing the margin after seeing the results invalidates the analysis.

Worked example 1: non-inferiority of proportions

A new, cheaper treatment cures 144 of 200 patients (\(\hat{p}_1 = 0.72\)); the reference treatment, 150 of 200 (\(\hat{p}_2 = 0.75\)). A non-inferiority margin of 10 percentage points (\(\delta = 0.10\)) and \(\alpha = 0.05\) were set in advance.

\( \hat{\Delta} = 0.72 - 0.75 = -0.03 \)

\( SE = \sqrt{\dfrac{0.72 \cdot 0.28}{200} + \dfrac{0.75 \cdot 0.25}{200}} = \sqrt{0.001008 + 0.000938} \approx 0.0441 \)

\( z_1 = \dfrac{-0.03 + 0.10}{0.0441} \approx 1.587, \qquad p = 1 - \Phi(1.587) \approx 0.056 \)

Since \(p \approx 0.056 > 0.05\), non-inferiority is not declared. The interval rule shows the same thing: the 90% interval for the difference, \(-0.03 \pm 1.645 \times 0.0441\), runs from −0.103 to 0.043, and its lower limit lies just below −0.10.

Conclusion: it cannot be ruled out that the new treatment cures slightly more than 10 points fewer patients than the reference. Note that this does not prove it is inferior; the result is simply inconclusive. If the two treatments were in fact equally effective, a study of this size would show non-inferiority with a probability of only 73%.

In the calculator: "Non-inferiority", "Proportions", p̂₁ = 0.72, p̂₂ = 0.75, n₁ = n₂ = 200, δ = 0.10 and direction "Treatment non-inferior". These are the values the page opens with.

Worked example 2: equivalence of means (TOST)

A laboratory compares a new measurement method with the reference one. With 100 samples for each method, it obtains means of \(\bar{x}_1 = 48\) and \(\bar{x}_2 = 50\) units, both with standard deviation 10. The methods are considered interchangeable if the real difference is less than 5 units (\(\delta = 5\)), with \(\alpha = 0.05\).

\( \hat{\Delta} = -2, \qquad SE = \sqrt{\dfrac{100}{100} + \dfrac{100}{100}} = \sqrt{2} \approx 1.414 \)

\( z_1 = \dfrac{-2 + 5}{1.414} \approx 2.121 \;(p_1 \approx 0.017), \qquad z_2 = \dfrac{5 - (-2)}{1.414} \approx 4.950 \;(p_2 \approx 0.0000004) \)

Both tests reject their null hypothesis, and \(p_{\text{TOST}} = \max(0.017,\ 0.0000004) = 0.017 < 0.05\): equivalence is declared. The 90% interval, \(-2 \pm 1.645 \times 1.414\), runs from −4.33 to 0.33 and fits entirely within \([-5, 5]\).

Conclusion: the difference between the two methods is, with 90% confidence, less than 5 units in either direction. Note that a classic two-means test would not have found a significant difference either (\(p \approx 0.16\)), but that alone would not have allowed you to claim that the methods are interchangeable.

In the calculator: "Equivalence (TOST)", "Means", x̄₁ = 48, x̄₂ = 50, s₁ = s₂ = 10, n₁ = n₂ = 100 and δ = 5.

How to interpret the result

If non-inferiority is declared (p-value < α), the data indicate that the treatment is not worse than the control by more than \(\delta\). It does not mean that it is equal or better: only that any loss is smaller than the margin. If, in addition, the whole interval lies above 0, there is also evidence of superiority; moving from non-inferiority to superiority is acceptable, but not the other way round.

If equivalence is declared, the difference is, with the stated confidence, smaller than \(\delta\) in both directions. It does not claim that the treatments are identical, but that any difference is too small to matter.

Development and additional details

If it is not declared, the result is inconclusive: the data do not rule out a difference larger than the margin. It does not prove that the treatment is inferior or that the treatments differ. The most common reason is that the sample was small for the chosen margin.

In the calculator, the result shows the decision with the p-value (the TOST p-value, for equivalence), the z statistics and a sentence explaining the conclusion with the confidence interval and the margin. On the chart, the red area is the rejection region of \(H_0\) on the standard normal and the lines mark the observed statistics. Under "Calculation details" you will find the observed difference, the standard error, the p-values of each test, the critical value and the interval.

Power of the study

Below the conclusion, the calculator shows the power of the test under the usual design assumption: that treatment and control are in fact equally effective (\(\Delta = 0\)). It is the probability that a study with your sample sizes and your variability shows non-inferiority or equivalence when it really holds. If it is low, an inconclusive result was to be expected.

For means, the link opens the sample size calculator for non-inferiority and equivalence with your margin, your α and a common standard deviation computed from your data, so you can see how many subjects per group would be needed to reach 80% power. Equivalence needs a larger sample than non-inferiority, because both tests have to be passed at once.

Common mistakes

  • Concluding equivalence because a classic test is not significant. The absence of significant differences does not prove equality.
  • Choosing or changing the margin after seeing the data.
  • Using the 95% interval with α = 0.05 per tail, or the 90% interval when the guideline requires 0.025 per tail. The interval level is \(1 - 2\alpha\).
  • Swapping the order of the groups: the difference is treatment − control, and non-inferiority means that it is not too negative.
  • Forgetting study quality: poor adherence, dropouts or imprecise measurement bring the two groups closer and favour false conclusions of non-inferiority. That is why analysing both by intention to treat and per protocol is recommended.

Frequently asked questions

  • What is the margin δ? The largest difference between treatment and control that is considered irrelevant in practice. It is set before the study on clinical, technical or regulatory grounds, not statistical ones.
  • How does non-inferiority differ from equivalence? Non-inferiority is one-tailed: it shows that the treatment is not worse than the control by more than δ. Equivalence (TOST) shows that it is neither worse nor better by more than δ, with two one-tailed tests at once.
  • Why is the 90% confidence interval used? Because TOST with α = 0.05 per tail is equivalent to checking that the 100(1 − 2α)% interval, that is, the 90% interval, fits within [−δ, +δ].
  • Which α should I use? In many fields, 0.05 per tail. In clinical trials for regulatory purposes, 0.025 per tail is usually required, which is equivalent to a 95% interval.
  • Can I conclude equivalence if a t-test is not significant? No. A non-significant test may be due to a small sample. To show equivalence you need an equivalence test with a margin set in advance.
  • Can a treatment be both non-inferior and non-superior? Yes: that is precisely equivalence. It can also be non-inferior without showing superiority, which is the most common outcome in these studies.
  • What does the power shown by the calculator mean? The probability of showing non-inferiority or equivalence with your sample sizes if there were in fact no difference between treatment and control.
  • How many subjects do I need? It depends on the margin, the variability, the expected real difference and the desired power. For means, work it out with the sample size calculator for non-inferiority and equivalence.

References: Non-inferiority trial and Equivalence test — Wikipedia; ICH E9 and E10, international guidelines on clinical trial design