Odds Ratio, Relative Risk & NNT Calculator
Enter a 2×2 table and get the full set of association and risk measures — odds ratio (OR), relative risk (RR), absolute and relative risk reduction, and the number needed to treat (NNT) — each with a 95% confidence interval. Everything runs in your browser; nothing is uploaded.
| Event | No event | |
|---|---|---|
| Group 1 (treated / exposed) | ||
| Group 2 (control / unexposed) |
N = "+(n1+n0)+". CIs are 95% (log-Wald for OR/RR)."+(zero?" A zero cell makes ratio CIs undefined — consider a continuity correction.":"")+ ((!zero && rdLo*rdHi<=0)?" The NNT CI spans infinity because the risk-difference CI crosses zero.":"")+"
"; out.innerHTML=html; } document.getElementById("or-go").addEventListener("click", run); run(); })();How to read it
OR, RR, and which to report
All of these come from the same 2×2 table but answer slightly different questions:
- Relative risk (RR) — how many times more likely the event is in group 1 than group 2. Intuitive for cohort studies and trials, where you can estimate actual risks.
- Odds ratio (OR) — the ratio of odds, not risks. It’s what logistic regression and case-control studies report; for rare outcomes it approximates the RR, but for common outcomes it is further from 1.
- Absolute risk difference and NNT — the clinical bottom line. NNT is how many patients you’d need to treat for one extra good outcome (1 ÷ absolute risk reduction). A small NNT is a big effect.
Report the RR or OR with its confidence interval, and pair it with the absolute difference — a large relative effect on a tiny baseline risk can still be clinically trivial.
Do it in R
tab <- matrix(c(15, 85, 30, 70), nrow = 2, byrow = TRUE)
# Odds ratio, relative risk with CIs:
epitools::oddsratio(tab)
epitools::riskratio(tab)For a small table, check the Fisher’s exact test; for a screening test’s accuracy, see the diagnostic test calculator.
FAQ
Frequently asked questions
Odds ratio or relative risk?
Use relative risk when you can estimate real risks (cohort studies, trials). Use the odds ratio for case-control studies and logistic regression. For rare outcomes they’re close; for common outcomes the OR overstates the RR.
What’s a good NNT?
There’s no universal threshold — it depends on the condition, the outcome’s seriousness and cost. A smaller NNT means fewer patients treated per benefit. Always report it with its confidence interval.
Why is my NNT confidence interval so wide (or infinite)?
When the risk-difference CI crosses zero (the effect isn’t statistically significant), the NNT CI runs to infinity — a known quirk of NNT, not a bug.
Need odds ratios adjusted for confounders, from a real dataset? We build the models and the report.