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 /
Worked Example
Group 1: 30 events out of 100. Group 2: 15 events out of 100.
- 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.
Frequently Asked Questions
When is relative risk preferred over odds ratio?
RR is preferred in cohort studies and randomized trials where incidence can be directly measured. Odds ratios are used in case-control studies where incidence cannot be determined. For rare events, OR approximates RR.
What is the difference between relative risk and absolute risk?
Relative risk is the ratio of two risks (multiplicative comparison). Absolute risk difference is the subtraction of two risks (additive). Both are needed: a large RR with tiny absolute risk may not be clinically important.
What does NNT mean?
Number Needed to Treat is the number of patients who must receive a treatment for one additional patient to benefit (or be harmed). Lower NNT means a more effective treatment. NNT = 1/|Risk Difference|.
Ready to run the numbers?
Open Relative Risk Calculator