Epidemiology and clinical trials keep coming back to one table: a group exposed to something (a treatment, a risk factor) and a group not exposed, each split by whether the outcome happened. From those four counts you can express the effect of the exposure in several complementary ways, and this calculator gives all of them with their confidence intervals.
- Relative risk (RR, risk ratio): how many times more likely the outcome is in the exposed group. RR = 1 means no association.
- Odds ratio (OR): the ratio of the odds of the outcome. It is the only measure available in case-control studies and the natural output of logistic regression.
- Absolute risk reduction (ARR): the difference in risk between control and treated groups, in percentage points — what actually changes for a patient.
- Number needed to treat (NNT = 1/ARR): how many people must be treated for one extra person to benefit, or to be harmed (NNTH) when the treatment increases risk.
Relative measures sound impressive ("halves the risk") while absolute ones keep them in proportion ("from 2 % to 1 %, so 100 people treated for one to benefit"). Reporting both is recommended by the CONSORT guidelines for trials.
How to use this calculator
- Choose the study design. In a cohort study or a trial the group sizes reflect real risks; in a case-control study only the odds ratio is valid.
- Enter the four cells: a and b for the exposed (or treated) group, with and without the outcome; c and d for the unexposed (or control) group.
- Choose the confidence level (95 % by default).
- Read RR, OR, the risks in each group, ARR and NNT, each with its interval. A zero cell triggers the usual 0.5 correction for the ratios.
The formula
With the risk in the exposed group and in the unexposed group:
Confidence intervals are computed on the log scale, then transformed back:
For the ARR, ; the NNT interval is the reciprocal of the ARR limits ( for 95 %). The p-value tests with .
Worked example
Hay fever and eczema (Bland & Altman, BMJ 2000; the default values). Among 561 eleven-year-olds with eczema, 141 had hay fever; among 14,453 without eczema, 928 did.
- Risks: = 141 / 561 = 25.1% and = 928 / 14,453 = 6.4%
- (95 % CI 3.35 to 4.57)
- (95 % CI 4 to 5.99), matching the published 4.89 (4.00 to 5.99)
Hay fever is common here, so the odds ratio is noticeably larger than the relative risk. Here the "exposure" raises the risk: the ARR is negative and the NNTH of about 5.3 simply restates the risk difference.
A trial (hypothetical): 30 events among 200 treated patients versus 60 among 200 controls. ARR = 15% (95 % CI 6.9% to 23.1%), so : treat about 7 patients to prevent one event, with an interval from 4.3 to 14.4. In relative terms, and .
Odds ratio calculator: when to use OR instead of RR
Use the relative risk whenever the data come from a cohort study or a randomised trial: it is the measure people intuitively understand. Use the odds ratio when:
- the study is a case-control study, where the investigator chooses how many cases and controls to recruit, so risks cannot be estimated (switch the design to Case-control);
- the result comes from logistic regression, which estimates odds ratios;
- you need a measure that is symmetric — the OR for outcome given exposure equals the OR for exposure given outcome.
When the outcome is rare (under about 10 % in both groups), OR and RR are close. When it is common, the OR moves further from 1 than the RR and should not be read as "times more likely". For converting betting odds rather than comparing groups, see the odds calculator.
Number needed to treat calculator: reading NNT
The number needed to treat turns an absolute risk reduction into people: NNT = 1/ARR. An NNT of 7 means that, over the study period, treating 7 patients prevents one event that would otherwise have happened. It is usually rounded up to a whole number. Lower is better; an NNT has meaning only together with the outcome, the treatment duration and the baseline risk, since the same drug has a larger NNT in low-risk patients.
When the treatment increases risk, the reciprocal is the number needed to harm (NNTH). When the ARR interval includes zero, the NNT interval passes through infinity: Altman (1998) recommends writing it as, for example, "NNTH 99 to ∞ to NNTB 4.8", which is exactly how this calculator reports it.
Frequently asked questions
What is the difference between relative risk and odds ratio?
Relative risk divides two probabilities (events / people at risk); the odds ratio divides two odds (events / non-events). They agree when the outcome is rare and diverge when it is common, the OR always lying further from 1.
How do I interpret a confidence interval that includes 1?
For RR or OR, an interval containing 1 means the data are compatible with no association at the chosen confidence level; the matching p-value is above α (0.05 for a 95 % interval).
Why is the NNT sometimes negative or infinite?
A negative ARR means the treatment increases risk, reported here as a number needed to harm. An ARR of exactly 0 corresponds to an infinite NNT: no number of patients treated gives one extra benefit.
What happens when a cell is zero?
The log-based intervals need non-zero cells, so the calculator adds 0.5 to every cell (Haldane–Anscombe correction) for RR and OR and says so in a note. Risks and ARR use the raw counts.
Can I use this calculator for a case-control study?
Yes, choose Case-control: the calculator then reports only the odds ratio with its interval and p-value, since risks, RR and NNT are not estimable in that design.
Sources
- Bland JM, Altman DG (2000), Statistics Notes: The odds ratio, BMJ 320:1468
- Altman DG (1998), Confidence intervals for the number needed to treat, BMJ 317:1309
- Altman DG, Practical Statistics for Medical Research, Chapman & Hall/CRC (1991)
- BMJ, Statistics at Square One, ch. 6 Differences between percentages and paired alternatives
- Katz D, Baptista J, Azen SP, Pike MC (1978), Obtaining confidence intervals for the risk ratio in cohort studies, Biometrics 34:469–474
Last updated: