Not worse by much: Farrington–Manning for proportions
To claim a new option isn't meaningfully worse, set a margin, test against it, and use a standard error worked out at that margin.
What runs in CodeSplash
- Two independent proportions (z, Fisher, Boschloo, Barnard, non-inferiority) Verified in Python and R
You will be able to
- State non-inferiority hypotheses for two proportions
- Explain why Farrington–Manning doesn't pool the groups
- Read non-inferiority and equivalence from an interval and a margin
A different burden of proof
ReadA cheaper test kit doesn't have to beat the old one. It has to be no worse than the old one by more than a 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). .
That reverses the burden of proof. The null hypothesis says the new option is worse by at least the margin:
A non-inferiorityNon-inferiority testAsks whether a new option is no worse than the standard by more than a margin chosen in advance, rather than whether they differ. claim needs evidence against that null.
Predict the p-value
PredictPredict first
Treatment has 18 of 30 successes, and control has 9 of 30. The ordinary z test gives p = .020. With a margin of 0.1, how will the one-sided non-inferiority p-value compare?
Reveal
Smaller: p < .001. The difference is now measured from −0.1, not from 0, and only one direction counts. It's an easier claim to support, so the margin matters a lot.
The right standard error
ReadUnder this null, the two proportions differ by , so pooling them as if they were equal would be wrong. Farrington–ManningFarrington–Manning testScore test that two proportions differ by a stated amount or ratio, with variance estimated at that null; used for non-inferiority. estimates both by maximum likelihood, subject to that difference:
Here the constrained estimates are and , so the standard error is about , and . The card gives z = 3.13.
Move the margin
ExploreThis explorable works on means, and the logic carries over. Narrow the margin, and watch the interval's relationship to it change. Non-inferiority needs only the lower limit above . Equivalence needs the whole interval inside .
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?
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 to see the result.
Here the difference's 95% interval has a lower limit of 0.049, well above −0.1.
Choose the margin first
Reflectis a judgment, not a statistical output. Ask how much worse you'd accept in return for what the new option offers, such as a lower cost or fewer side effects. Trials often set it as a fraction of the established treatment's known benefit.
Fix it before you see the data, and write down why. A margin chosen afterwards can make any result look non-inferior.
For a product you know, what's the largest loss you'd accept, and who would have to agree with you?
When lower is better
ReadIf the event is bad, such as a rejection or an infection, set Better outcome is to lower. The test then looks at the upper side.
For Berkeley's rejections, men's 55.5% against women's 69.6% with a margin of 0.05 gives p < .001. Berkeley isn't a real non-inferiority question; it only shows the option at work.
Equivalence, on a ratio scale
ReadEquivalence asks that the effect be inside two bounds, so both one-sided tests must pass. On the risk-ratio scale, a margin of 0.8 means bounds of 0.80 and 1.25.
Berkeley's admission ratio is 1.47 (95% CI 1.35 to 1.59), entirely above the upper bound. Equivalence isn't shown, despite the 4,526 applicants. A large sample can show that an effect is inside the bounds only if it really is.
Check your understanding
CheckpointCheck yourself
The difference between a new and an old option is −0.04, the margin is 0.10, and the standard error at the margin is 0.025. What is z?
Show the answer
Answer: 2.4
(−0.04 + 0.10) / 0.025 = 2.4. The new option is observed to be slightly worse, yet the data can still support non-inferiority.
Check yourself
The 95% interval for the difference (new minus old) runs from −0.08 to 0.02, and the margin is 0.10. What can you claim?
Show the answer
Answer: a
The lower limit is above −0.10, so non-inferiority holds. Zero is inside the interval, so superiority isn't shown. Containing zero doesn't count against a non-inferiority claim.
Check yourself
An ordinary difference test gives p = 0.30, with no margin set. Which conclusion is right?
Show the answer
Answer: c
A large p-value doesn't show that a difference is small. Without a margin, there's nothing to be non-inferior to.
Check yourself
A risk-ratio equivalence margin of 0.8 has a matching upper bound of . What is it?
Show the answer
Answer: 1.25
1 / 0.8 = 1.25. Ratios are symmetric on the log scale, so the bounds are reciprocals of each other.
Do it in CodeSplash
In the appChoose Groups, Outcome and Event level as usual, then set Hypothesis to Non-inferiority or Equivalence. Margin on the chooses Risk difference or Risk ratio, which brings up Margin (difference) or Margin (ratio). Better outcome is sets the direction.
import numpy as np
from scipy import optimize, stats
def fm_z(x1, n1, x2, n2, delta):
"""Farrington-Manning z for H0: p1 - p2 = delta."""
def nll(p2):
return -(stats.binom.logpmf(x1, n1, p2 + delta) + stats.binom.logpmf(x2, n2, p2))
bounds = (max(0, -delta) + 1e-9, min(1, 1 - delta) - 1e-9)
p2 = optimize.minimize_scalar(nll, bounds=bounds, method="bounded").x
p1 = p2 + delta
return (x1 / n1 - x2 / n2 - delta) / np.sqrt(p1 * (1 - p1) / n1 + p2 * (1 - p2) / n2)
z = fm_z(18, 30, 9, 30, delta=-0.10)
print(z, stats.norm.sf(z))fm_z <- function(x1, n1, x2, n2, delta) {
nll <- function(p2) -(dbinom(x1, n1, p2 + delta, log = TRUE) + dbinom(x2, n2, p2, log = TRUE))
p2 <- optimize(nll, c(max(0, -delta), min(1, 1 - delta)), tol = 1e-8)$minimum
p1 <- p2 + delta
(x1 / n1 - x2 / n2 - delta) / sqrt(p1 * (1 - p1) / n1 + p2 * (1 - p2) / n2)
}
z <- fm_z(18, 30, 9, 30, delta = -0.10)
c(z = z, p = pnorm(z, lower.tail = FALSE))Recap
Recap- Non-inferiority tests against a margin, so the burden of proof falls on showing "not much worse".
- Farrington–Manning works out its standard error at the margin, not by pooling.
- The margin carries the claim. Set it before the data, and justify it in words.
Concepts in this lesson