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 / risk2

Risk Group 1

risk_group1 = risk1

Risk Group 2

risk_group2 = risk2

Risk Difference

risk_diff = risk1 - risk2

NNT (Number Needed to Treat)

nnt = 1 / abs(risk1 - risk2)

Variables

VariableDescriptionDefault
aGroup 1 - Event (a)30
bGroup 1 - No Event (b)70
cGroup 2 - Event (c)15
dGroup 2 - No Event (d)85
risk1Derived value= a / (a + b)calculated
risk2Derived 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
  1. 01Risk Group 1 = 30 / (30+70) = 30/100 = 0.30
  2. 02Risk Group 2 = 15 / (15+85) = 15/100 = 0.15
  3. 03RR = 0.30 / 0.15 = 2.0
  4. 04Risk Difference = 0.30 - 0.15 = 0.15
  5. 05NNT = 1 / 0.15 ≈ 6.67
  6. 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