Skip to main content
MedCalc
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
working

Relative Risk Calculator

Use this relative risk calculator to compare the probability of an outcome between two groups. Enter data from a 2x2 table to calculate the risk ratio (RR), 95% confidence interval, and p-value. The program also reports the Number Needed to Treat (NNT) with it's 95% confidence interval. Commonly used in cohort and clinical studies.

Example: 40/100 exposed vs 20/100 controls (unexposed).

 

Exposed group
a
b
Control group
c
d

Computational notes

The relative risk (RR), its standard error and 95% confidence interval are calculated according to Altman, 1991.

The relative risk or risk ratio is given by

Relative risk$$ RR = \frac {a/(a+b) } { c/(c+d) } $$

with the standard error of the log relative risk being

Relative risk - standard error$$ \operatorname{SE} \left \{ \operatorname{ln}\left(RR\right) \right \} = \sqrt { \frac {1}{a} + \frac {1}{c} - \frac {1}{a+b} - \frac {1}{c+d} } $$

and 95% confidence interval

Relative risk - confidence interval$$ \operatorname{95\%\text{ } CI} = \operatorname{exp} \Big( \text{ } \operatorname{ln}\left(RR\right) - 1.96 \times \operatorname{SE} \left \{ \operatorname{ln}\left(RR\right) \right \} \text{ } \Big) \quad \text{ to }\quad \operatorname{exp} \Big(\text{ } \operatorname{ln}\left(RR\right) + 1.96 \times \operatorname{SE} \left \{ \operatorname{ln}\left(RR\right) \right \} \text{ }\Big)$$

Where zeros cause problems with computation of the relative risk or its standard error, 0.5 is added to all cells (a, b, c, d) (Pagano & Gauvreau, 2000; Deeks & Higgins, 2010).

Number Needed to Treat (NNT)

The number needed to treat (NNT) is the estimated number of patients who need to be treated with the new treatment rather than the standard treatment (or no treatment) for one additional patient to benefit (Altman 1998).

A negative number for the number needed to treat has been called the number needed to harm.

MedCalc uses the terminology suggested by Altman (1998) with NNT(Benefit) and NNT(Harm) being the number of patients needed to be treated for one additional patient to benefit or to be harmed respectively.

The 95% confidence interval is calculated according to Daly (1998) and is reported as suggested by Altman (1998).

Test of significance: the P-value is calculated according to Sheskin, 2004 (p. 542). A standard normal deviate (z-value) is calculated as ln(RR)/SE{ln(RR)}, and the P-value is the area of the normal distribution that falls outside ±z (see Values of the Normal distribution table).

Relative risk vs odds ratio

Relative risk is preferred in cohort studies, while the odds ratio is commonly used in case-control studies. For rare outcomes, both measures are similar.

Literature

  • Altman DG (1991) Practical statistics for medical research. London: Chapman and Hall.
  • Altman DG (1998) Confidence intervals for the number needed to treat. British Medical Journal 317: 1309-1312. PubMed
  • Daly LE (1998) Confidence limits made easy: interval estimation using a substitution method. American Journal of Epidemiology 147: 783-790. PubMed
  • Deeks JJ, Higgins JPT (2010) Statistical algorithms in Review Manager 5. Retrieved from https://training.cochrane.org/
  • Kirkwood BR, Sterne JAC (2003) Essential medical statistics, 2nd ed. Oxford: Blackwell Science.
  • Pagano M, Gauvreau K (2000) Principles of biostatistics. 2nd ed. Belmont, CA: Brooks/Cole.
  • Parshall MB (2013) Unpacking the 2 x 2 table. Heart & Lung 42:221-226. PubMed
  • Sheskin DJ (2004) Handbook of parametric and non-parametric statistical procedures. 3rd ed. Boca Raton: Chapman & Hall /CRC.

How to cite this page

  • MedCalc Software Ltd. Relative Risk Calculator (Risk Ratio, 2x2 Table). https://www.medcalc.org/en/calc/relative_risk.php (Version 23.5.5; accessed May 10, 2026)

Other free statistical calculators

See also

Trusted by researchers worldwide — download the full MedCalc statistical software and perform advanced statistical analysis in seconds. No registration required.