Relative Risk Calculator

Enter the number of people with and without the outcome in two groups to get the relative risk (risk ratio) with its confidence interval and p-value. The calculator also gives the relative risk reduction, the absolute risk difference, the number needed to treat and the odds ratio from the same table.

Counts

2 × 2 table of counts
Total
100
100
Total45155200

Put the exposed or treated group in the first row and the outcome of interest (the event) in the first column. Type over the labels to rename them.

Confidence level

Load a worked example

Relative risk (risk ratio)

0.5095% CI 0.29 to 0.87

The risk in row 1 is 0.50 times the risk in row 2 (15.0% vs 30.0%).

Relative risk
0.500
95% CI 0.287 to 0.870
Risk difference (row 1 − row 2)
−15.00 points
95% CI −26.15 to −3.41
Relative risk reduction
50.0%
95% CI 13.0% to 71.3%
Odds ratio
0.412
95% CI 0.205 to 0.826
NNT to benefit
6.67
95% CI 3.8 to 29.3
Risk in each row
15.0% vs 30.0%
p (log odds ratio, z test)
0.0124
p (Pearson χ²)
0.0111
χ² = 6.452, df 1
p (Fisher’s exact)
0.0171
  • The outcome is common (over 10%), so the odds ratio is noticeably further from 1 than the relative risk. Do not describe this odds ratio as a risk ratio.

Report it like this

The risk was 15.0% (15/100) in Treatment and 30.0% (30/100) in Control; RR = 0.50, 95% CI 0.29 to 0.87, p = .014.

How to use the calculator

Put the exposed or treated group in the first row and the comparison group in the second. Put the outcome you are counting (the event) in the first column:

Layout of the 2 × 2 table
EventNo eventRisk
Exposed / treatmentabp₁ = a/(a + b)
Unexposed / controlcdp₂ = c/(c + d)

The relative risk compares the first row with the second. Swapping the rows gives the reciprocal (a relative risk of 0.5 becomes 2). Swapping the columns, so that you count non-events instead, gives a different relative risk altogether, so decide which outcome you are reporting first.

Relative risk formula and confidence interval

RR = [a/(a + b)] / [c/(c + d)]

The confidence interval is calculated on the log scale (Katz et al. 1978) and then exponentiated:

SE(ln RR) = √(1/a − 1/(a + b) + 1/c − 1/(c + d)),   CI = exp(ln RR ± 1.96 × SE)

The p-value comes from z = ln RR / SE. If a cell is zero, 0.5 is added to every cell first (the Haldane–Anscombe correction), and the calculator says so.

Relative risk reduction = 1 − RR, the proportion of the baseline risk removed by the treatment; its interval is 1 minus the limits of the relative risk interval. Risk difference = p₁ − p₂, with the Newcombe score interval, and the number needed to treat is 1 divided by the absolute risk difference.

Worked example

In a trial, 15 of 100 patients on treatment and 30 of 100 on control had the event (the default table).

  • Risk with treatment = 15/100 = 15.0%; risk with control = 30/100 = 30.0%.
  • RR = 0.15 / 0.30 = 0.50. SE(ln RR) = √(1/15 − 1/100 + 1/30 − 1/100) = 0.283.
  • 95% CI = exp(ln 0.50 ± 1.96 × 0.283) = 0.29 to 0.87; z = −2.45, p = .014.
  • Relative risk reduction = 50% (95% CI 13.0% to 71.3%): treatment removes half of the risk.
  • Risk difference = −15.0 percentage points (95% CI −26.1 to −3.4), so 7 patients need treatment to prevent one event.

In the cohort example, 24 of 120 exposed and 12 of 130 unexposed people developed the disease: risks 20.0% and 9.2%, RR = 2.17 (95% CI 1.13 to 4.14), p = .019. The odds ratio from the same table is 2.46, further from 1, because the outcome is common.

Relative risk or odds ratio?

  • Cohort studies and randomized trials: report the relative risk, ideally with the absolute risk difference. It is the measure readers understand as “times as likely”.
  • Case-control studies: the relative risk cannot be estimated, because the researcher chose how many cases and controls to include. Report the odds ratio with the odds ratio calculator.
  • Rare outcomes (under about 10% in both groups): the two measures are close, so an odds ratio is a fair estimate of the relative risk. For common outcomes they diverge, and an odds ratio should not be described as a risk ratio.

Always give the absolute risks as well. A relative risk of 0.5 means something very different when the risk falls from 30% to 15% than when it falls from 0.2% to 0.1%.

How to report a relative risk

Give the number and percentage with the outcome in each group, the relative risk to two decimals, its confidence interval and the p-value:

The event occurred in 15 of 100 patients (15.0%) with treatment and 30 of 100 (30.0%) with control (relative risk 0.50, 95% CI 0.29 to 0.87, p = .014).

Name the reference group. A relative risk below 1 means a lower risk in the first group, above 1 a higher risk. If the interval includes 1, the difference is not statistically significant at that level. To pool relative risks from several studies, use the forest plot maker.

Questions

How do I calculate relative risk?
Divide the risk in the exposed group by the risk in the unexposed group. Each risk is the number with the outcome divided by everyone in that group. With 15 events among 100 treated patients and 30 among 100 controls, the relative risk is 0.15 ÷ 0.30 = 0.50.
How do I calculate a 95% confidence interval for relative risk?
Take the natural log of the relative risk, compute its standard error as √(1/a − 1/(a + b) + 1/c − 1/(c + d)), add and subtract 1.96 standard errors and exponentiate both limits. For the example above, the standard error is 0.283 and the 95% CI is 0.29 to 0.87.
What does a relative risk of 1.5 mean?
The outcome is 1.5 times as likely in the exposed group as in the unexposed group, a 50% relative increase in risk. Whether that matters depends on the baseline risk: from 2% to 3% is a small absolute change, from 20% to 30% a large one.
What is the difference between relative risk and relative risk reduction?
Relative risk reduction is 1 minus the relative risk. A relative risk of 0.75 means a 25% relative risk reduction: the treatment removes a quarter of the risk seen in the control group.
What is the difference between relative risk and odds ratio?
Relative risk compares the probability of the outcome; the odds ratio compares the odds (events divided by non-events). They are almost equal when the outcome is rare. When it is common, the odds ratio is further from 1. Case-control studies can only estimate the odds ratio.
Is the relative risk significant if the confidence interval includes 1?
No. A relative risk of 1 means equal risk in both groups, so an interval that includes 1 means the data are compatible with no difference at that confidence level, and the p-value will be above the matching threshold (0.05 for a 95% interval).

Sources