Skip to content

Relative Risk Calculator (RR, Odds Ratio, NNT)

Relative risk, odds ratio, absolute risk reduction and number needed to treat from a 2 × 2 table, with 95 % CIs.

Your details

Study design
%

Results update as you type

Relative risk (risk ratio)

3.9144

Relative risk: confidence interval
3.35 to 4.574
Odds ratio
4.8928
Odds ratio: confidence interval
3.998 to 5.988
p-value (test of OR = 1)
1.5 × 10⁻⁵³
Risk in exposed / treated
25.13%
Risk in unexposed / control
6.42%
Absolute risk reduction (control − treated)
-18.71%
Absolute risk reduction: confidence interval
-22.32% to -15.1%
Number needed to treat (NNTB) or harm (NNTH)
NNTH 5.3
NNT: confidence interval
NNTH 4.5 to 6.6

The outcome is common (above 10 %): the odds ratio (4.893) overstates the relative risk (3.914); report the RR for a cohort or a trial.

NNTH rounded up to whole people: 6.

Step-by-step solution
  1. Rₑ = a / (a + b) = 141 / 561 = 25.13% ; R₀ = c / (c + d) = 928 / 14453 = 6.42%
  2. RR = Rₑ / R₀ = 3.914 ; SE(ln RR) = √(1/a − 1/(a + b) + 1/c − 1/(c + d))
  3. OR = (a × d) / (b × c) = 4.893 ; SE(ln OR) = √(1/a + 1/b + 1/c + 1/d)
  4. ARR = R₀ − Rₑ = -18.71% ; NNT = 1 / |ARR| = 5.34

This calculator gives estimates for information only and is not medical advice. Talk to a doctor or registered dietitian before making health decisions.

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

  1. 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.
  2. 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.
  3. Choose the confidence level (95 % by default).
  4. 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 Re=a/(a+b)R_e = a/(a + b) the risk in the exposed group and R0=c/(c+d)R_0 = c/(c + d) in the unexposed group:

RR=ReR0OR=a db cARR=R0−ReNNT=1ARRRR = \frac{R_e}{R_0} \qquad OR = \frac{a\,d}{b\,c} \qquad ARR = R_0 - R_e \qquad NNT = \frac{1}{ARR}

Confidence intervals are computed on the log scale, then transformed back:

SE(ln⁡RR)=1a−1a+b+1c−1c+dSE(ln⁡OR)=1a+1b+1c+1dSE(\ln RR) = \sqrt{\frac1a - \frac1{a+b} + \frac1c - \frac1{c+d}} \qquad SE(\ln OR) = \sqrt{\frac1a + \frac1b + \frac1c + \frac1d}
RR×e±z SE(ln⁡RR)OR×e±z SE(ln⁡OR)RR \times e^{\pm z\,SE(\ln RR)} \qquad OR \times e^{\pm z\,SE(\ln OR)}

For the ARR, SE=Re(1−Re)/(a+b)+R0(1−R0)/(c+d)SE = \sqrt{R_e(1 - R_e)/(a + b) + R_0(1 - R_0)/(c + d)}; the NNT interval is the reciprocal of the ARR limits (z=1.96z = 1.96 for 95 %). The p-value tests OR=1OR = 1 with z=ln⁡OR/SE(ln⁡OR)z = \ln OR / SE(\ln OR).

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: ReR_e = 141 / 561 = 25.1% and R0R_0 = 928 / 14,453 = 6.4%
  • RR=3.91RR = 3.91 (95 % CI 3.35 to 4.57)
  • OR=(141×13525)/(420×928)=4.89OR = (141 \times 13525) / (420 \times 928) = 4.89 (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 NNT=1/0.15=6.67NNT = 1 / 0.15 = 6.67: treat about 7 patients to prevent one event, with an interval from 4.3 to 14.4. In relative terms, RR=0.5RR = 0.5 and OR=0.41OR = 0.41.

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

Last updated:

More Statistics calculators

People also use