Relative Risk Calculator Formula
Understand the math behind the relative risk calculator. Each variable explained with a worked example.
Formulas Used
Relative Risk (RR)
relative_risk = risk1 / risk2Risk Group 1
risk_group1 = risk1Risk Group 2
risk_group2 = risk2Risk Difference
risk_diff = risk1 - risk2NNT (Number Needed to Treat)
nnt = 1 / abs(risk1 - risk2)Variables
| Variable | Description | Default |
|---|---|---|
a | Group 1 - Event (a) | 30 |
b | Group 1 - No Event (b) | 70 |
c | Group 2 - Event (c) | 15 |
d | Group 2 - No Event (d) | 85 |
risk1 | Derived value= a / (a + b) | calculated |
risk2 | Derived value= c / (c + d) | calculated |
How It Works
How to Calculate Relative Risk
Formula
RR = [a / (a+b)] / [c / (c+d)]
Relative risk compares the probability of an event in the exposed group to the probability in the unexposed group. RR = 1 means no difference. RR > 1 means higher risk in the exposed group. RR < 1 means the exposure is protective. The Number Needed to Treat (NNT) = 1 / |Risk Difference|.
Worked Example
Group 1: 30 events out of 100. Group 2: 15 events out of 100.
a = 30b = 70c = 15d = 85
- 01Risk Group 1 = 30 / (30+70) = 30/100 = 0.30
- 02Risk Group 2 = 15 / (15+85) = 15/100 = 0.15
- 03RR = 0.30 / 0.15 = 2.0
- 04Risk Difference = 0.30 - 0.15 = 0.15
- 05NNT = 1 / 0.15 ≈ 6.67
- 06Group 1 has twice the risk; for every ~7 people treated, one event is attributable to exposure.
Ready to run the numbers?
Open Relative Risk Calculator