Relative Risk Calculator
Enter how many people in the exposed (or treated) and unexposed (or control) groups did and did not have the outcome. You get both risks, the relative risk, the risk difference, NNT or NNH and a 95% confidence interval.
Updated
Report a problem
Formula
- Risks:
risk1 = a / (a + b),risk2 = c / (c + d) - Relative risk:
RR = risk1 / risk2 - Risk difference:
RD = risk1 - risk2 - NNT:
1 / |RD|, rounded up - 95% CI:
exp(ln(RR) +/- 1.959964 x SE)withSE = sqrt(1/a - 1/(a+b) + 1/c - 1/(c+d))
Worked example
Table a=20, b=80, c=10, d=90. Risks are 20% and 10%, so RR = 2, RD = 10 points and NNT = 1 / 0.10 = 10. SE = 0.3606, so the 95% CI is 0.9866 to 4.0545.
Frequently asked questions
How do you calculate relative risk?
Divide the risk in the exposed group, a/(a+b), by the risk in the unexposed group, c/(c+d). For 20, 80 / 10, 90 the risks are 20% and 10%, so the relative risk is 2.
What is the difference between relative risk and risk difference?
Relative risk is a ratio and says how many times more likely the outcome is. Risk difference is a subtraction, here 20% - 10% = 10 percentage points, and shows the absolute size of the effect. A doubled risk can be a tiny absolute change when the outcome is rare.
How is the number needed to treat calculated?
NNT = 1 / |risk difference|, rounded up to a whole person. A 10 point difference gives 1 / 0.10 = 10. When the exposure raises risk it is called the number needed to harm.
How is the confidence interval calculated, and what if a group has zero events?
The log method uses SE = sqrt(1/a - 1/(a+b) + 1/c - 1/(c+d)) and gives exp(ln(RR) +/- 1.96 x SE). For 20, 80 / 10, 90 SE = 0.3606 and the interval is 0.9866 to 4.0545. With no events in one of the groups the log method fails, so those inputs are rejected.