Relative Risk (Risk Ratio) Calculator
Compute relative risk (risk ratio), absolute risks, risk difference, and 95% confidence intervals from a 2×2 table. Ideal for epidemiology, clinical trials, and evidence-based medicine.
Enter 2×2 Table Data
| Outcome Present | Outcome Absent | Total | |
|---|---|---|---|
| Exposed / Treatment |
a
|
b
|
100 |
| Unexposed / Control |
c
|
d
|
100 |
| Total | 40 | 160 | 200 |
Results
Absolute Risks
Risk in exposed (Re): 0.30 (30.0%)
Risk in unexposed (Ru): 0.10 (10.0%)
Risk difference (Re − Ru): 0.20 (20.0 percentage points)
Relative Risk & CI
Relative risk (RR): 3.00 Increased risk
Log(RR): 1.0986
Standard error of log(RR): 0.3162
95% CI for RR: 1.61 to 5.59 Significant (CI excludes 1)
Plain-language interpretation
In this example, the exposed group has 3.0 times the risk of the outcome compared with the unexposed group (30.0% vs 10.0%). The 95% confidence interval (1.61 to 5.59) does not include 1, suggesting a statistically significant association at the 0.05 level.
What is relative risk?
Relative risk (RR), also called the risk ratio, compares the probability of an outcome in an exposed group to the probability in an unexposed (or control) group. It is widely used in epidemiology, clinical trials, and public health.
From a 2×2 table:
Outcome +
(event) Outcome −
(no event)
Exposed a b
Unexposed c d
Risks:
\( R_e = \dfrac{a}{a + b} \) (risk in exposed)
\( R_u = \dfrac{c}{c + d} \) (risk in unexposed)
Relative risk:
\( RR = \dfrac{R_e}{R_u} = \dfrac{a/(a+b)}{c/(c+d)} \)
How to interpret relative risk
- RR = 1: no difference in risk between exposed and unexposed.
- RR > 1: exposure is associated with a higher risk (harmful effect).
- RR < 1: exposure is associated with a lower risk (protective effect).
For example, RR = 2 means the exposed group has twice the risk of the outcome. RR = 0.5 means the risk is halved in the exposed group.
Absolute risk vs relative risk vs risk difference
Relative risk alone can be misleading if the baseline risk is very low or very high. Always consider the absolute risks and the risk difference:
- Absolute risk in exposed: \( R_e = a / (a + b) \)
- Absolute risk in unexposed: \( R_u = c / (c + d) \)
- Risk difference (RD): \( RD = R_e - R_u \)
In the default example, risk increases from 10% to 30% (RR = 3.0), so the absolute increase is 20 percentage points.
Confidence interval for relative risk
Because the sampling distribution of RR is skewed, confidence intervals are usually computed on the log scale and then exponentiated.
Step 1 – Compute RR and log(RR):
\( RR = \dfrac{a/(a+b)}{c/(c+d)} \)
\( \ln(RR) = \ln(R_e) - \ln(R_u) \)
Step 2 – Standard error of log(RR):
\( SE_{\ln(RR)} = \sqrt{\dfrac{1}{a} - \dfrac{1}{a+b} + \dfrac{1}{c} - \dfrac{1}{c+d}} \)
Step 3 – Confidence interval on log scale:
\( \ln(RR) \pm z_{\alpha/2} \times SE_{\ln(RR)} \)
For a 95% CI, \( z_{\alpha/2} \approx 1.96 \).
Step 4 – Back-transform to RR scale:
\( \text{Lower CI} = \exp\big(\ln(RR) - z_{\alpha/2} SE_{\ln(RR)}\big) \)
\( \text{Upper CI} = \exp\big(\ln(RR) + z_{\alpha/2} SE_{\ln(RR)}\big) \)
If the confidence interval includes 1, the association is not statistically significant at the chosen confidence level.
Worked example
Suppose a cohort study reports:
- 30 events among 100 exposed participants (a = 30, b = 70)
- 10 events among 100 unexposed participants (c = 10, d = 90)
Then:
- \( R_e = 30/100 = 0.30 \) (30%)
- \( R_u = 10/100 = 0.10 \) (10%)
- \( RR = 0.30 / 0.10 = 3.0 \)
The exposed group has three times the risk of the outcome compared with the unexposed group. The calculator also shows the 95% confidence interval and whether it excludes 1.
Relative risk vs odds ratio
- Relative risk compares probabilities and is most natural in cohort studies and randomized trials.
- Odds ratio compares odds and is commonly used in case–control studies and logistic regression.
- When the outcome is rare (e.g., <10%), the odds ratio approximates the relative risk. For common outcomes, the odds ratio can substantially overstate the strength of association.
When to use this relative risk calculator
Use this tool when you have:
- Data from a cohort study or clinical trial.
- Counts of participants with and without the outcome in exposed and unexposed groups.
- A need to report RR, absolute risks, risk difference, and confidence intervals.