Relative Risk Calculator
Calculate relative risk (risk ratio), confidence intervals, absolute risk difference, NNT, and attributable risk for epidemiological studies and clinical
Relative Risk Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: RR = (a/b) / (c/d)
Worked example โ RR = 9.0 (95% CI: 3.63-22.30) | Smokers have 9x the lung cancer risk | NNT = 13
Formula
RR = (a/b) / (c/d)
Where a = events in exposed group, b = total in exposed group, c = events in unexposed group, d = total in unexposed group. The 95% confidence interval is calculated using the log transformation: CI = exp(ln(RR) +/- z * SE(ln(RR))), where SE(ln(RR)) = sqrt(1/a - 1/b + 1/c - 1/d).
Worked Examples
Example 1: Smoking and Lung Cancer Risk
Problem:In a cohort study, 45 out of 500 smokers developed lung cancer vs 5 out of 500 non-smokers. Calculate the relative risk.
Solution:Risk in exposed (smokers) = 45/500 = 0.09 (9%) Risk in unexposed (non-smokers) = 5/500 = 0.01 (1%) RR = 0.09 / 0.01 = 9.0 ln(RR) = 2.197, SE(ln RR) = sqrt(1/45 - 1/500 + 1/5 - 1/500) = 0.463 95% CI = exp(2.197 +/- 1.96 * 0.463) = (3.63, 22.30) ARD = 0.09 - 0.01 = 0.08, NNT = 1/0.08 = 13
Result:RR = 9.0 (95% CI: 3.63-22.30) | Smokers have 9x the lung cancer risk | NNT = 13
Example 2: Vaccine Efficacy Study
Problem:In a vaccine trial, 8 of 1000 vaccinated participants got infected vs 40 of 1000 in the placebo group. Calculate vaccine efficacy.
Solution:Risk in vaccinated = 8/1000 = 0.008 (0.8%) Risk in placebo = 40/1000 = 0.04 (4%) RR = 0.008 / 0.04 = 0.20 Vaccine Efficacy = (1 - RR) * 100 = 80% 95% CI for RR: (0.094, 0.426) ARD = 0.008 - 0.04 = -0.032, NNT = 1/0.032 = 32
Result:RR = 0.20 (80% vaccine efficacy) | 95% CI: 0.094-0.426 | NNT = 32 vaccinations to prevent 1 infection
Frequently Asked Questions
What is relative risk and how is it calculated?
Relative risk (RR), also called risk ratio, compares the probability of an event occurring in an exposed group versus an unexposed group. RR = (events in exposed / total exposed) / (events in unexposed / total unexposed). An RR of 2.0 means the exposed group has twice the risk of the outcome compared to the unexposed group. An RR of 0.5 means the exposed group has half the risk (protective effect). RR = 1.0 means no difference. Relative risk is used in cohort studies and randomized controlled trials where you can directly measure incidence rates in both groups.
What is the difference between relative risk and odds ratio?
Relative risk compares probabilities (risk in exposed / risk in unexposed), while odds ratio compares odds (odds in exposed / odds in unexposed). When the outcome is rare (< 10% incidence), RR and OR are approximately equal. As the outcome becomes more common, OR increasingly overestimates the RR. For example, if risk is 30% vs 10%, RR = 3.0 but OR = 3.86. RR is more intuitive and preferred when calculable (cohort studies, RCTs). OR is used in case-control studies where true incidence cannot be determined. Always specify which measure you are reporting.
How do I interpret the confidence interval for relative risk?
The confidence interval (CI) provides a range of plausible values for the true population RR. A 95% CI means we are 95% confident the true RR falls within this range. The key is whether the CI crosses 1.0: if entirely above 1.0 (e.g., 1.5-3.2), the increased risk is statistically significant. If entirely below 1.0 (e.g., 0.3-0.8), the protective effect is significant. If the CI includes 1.0 (e.g., 0.8-1.4), the result is not statistically significant. Narrower CIs indicate more precise estimates, typically from larger sample sizes.
What is Number Needed to Treat (NNT) and how does it relate to RR?
NNT is the number of patients who need to be treated to prevent one additional adverse event, calculated as 1 / absolute risk difference. It translates relative risk into a clinically meaningful metric. For example, if a drug reduces mortality from 10% to 7%, the absolute risk reduction is 3%, and NNT = 1/0.03 = 34. This means you need to treat 34 patients to prevent one death. NNT complements RR because a large RR can correspond to a small absolute benefit when the baseline risk is low. A drug cutting risk by 50% (RR=0.5) from 2% to 1% has NNT=100, while the same RR from 40% to 20% has NNT=5.
When should I use relative risk vs absolute risk reduction?
Both measures should be reported together as they provide complementary information. Relative risk is useful for understanding the strength of association between exposure and outcome across different populations. Absolute risk reduction (ARD) is better for clinical decision-making because it accounts for baseline risk. Drug advertisements often emphasize RR because it sounds more impressive: a drug that reduces heart attack risk by 50% (RR=0.5) sounds better than saying it reduces risk from 2% to 1% (ARD=1%). Health literacy research shows that patients make better decisions when given absolute risks rather than relative risks.
Why is the confidence interval for relative risk computed on the log scale?
A ratio is bounded below by zero and unbounded above, so its sampling distribution is right-skewed and a symmetric interval built directly on RR can dip below zero or misstate the upper limit. Taking the natural logarithm makes the quantity roughly symmetric and approximately normal, so a limit is ln RR plus or minus z times the standard error, then exponentiated back. The result is multiplicatively symmetric about the point estimate, which is why a published interval such as 3.63 to 22.30 looks lopsided around an RR of 9.
What is the attributable risk percent, and how does it differ from the population attributable risk?
The attributable risk percent, sometimes the attributable fraction among the exposed, is RR minus one divided by RR, expressed as a percentage. It answers what share of the disease burden in exposed people is due to the exposure, so an RR of 4 attributes 75 percent of their cases to it. The population attributable risk instead weights that by how common the exposure is across the whole population, so a strong risk factor that few people encounter contributes little. Relative Risk Calculator reports the population figure at an assumed exposure prevalence of 50 percent.
Why can relative risk not be calculated directly from a case-control study?
A case-control study starts by selecting a fixed number of people with the disease and a comparison group without it, so the ratio of cases to non-cases is set by the investigator rather than by nature. Incidence, which is cases divided by a population followed over time, therefore cannot be recovered from the sampling fractions. The odds ratio survives this design because it is invariant to whether you sample on exposure or on outcome, and Cornfield showed it approximates the risk ratio when the disease is rare.
When should an incidence rate ratio or hazard ratio be used instead of a risk ratio?
A risk ratio needs every participant to be observed over a comparable period, because it divides events by people. When subjects enter at different times, drop out, or are censored at the end of a study, an incidence rate ratio divides events by accumulated person-time instead, and a hazard ratio from Cox regression compares instantaneous event rates while allowing covariate adjustment. Long follow-up, competing causes of death and staggered enrolment are the usual signals that a simple two-by-two risk ratio will mislead.
How is vaccine efficacy derived from the relative risk?
Vaccine efficacy is one minus the relative risk of the outcome in vaccinated versus unvaccinated participants, expressed as a percentage. If 8 of 1000 vaccinated and 40 of 1000 placebo recipients become infected, the risks are 0.008 and 0.04, the RR is 0.20, and efficacy is 80 percent. The confidence interval is obtained by transforming the interval for RR the same way, so an RR interval of 0.094 to 0.426 corresponds to efficacy between about 57 and 91 percent. Efficacy measured in a trial is not the same as effectiveness observed in routine use.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎAlpaca Gestation Calculator
Calculate alpaca gestation with inputs, formulas, and instant results.
๐งฎCat Pregnancy Calculator โ Due Date & Gestation
Calculate cat pregnancy with inputs, formulas, and instant results.
๐งฎCow Gestation Calculator
Calculate cow gestation with inputs, formulas, and instant results.
๐งฎDog Pregnancy Calculator: Due Date by Breed
Calculate dog pregnancy with inputs, formulas, and instant results.
๐งฎGoat Gestation Calculator
Calculate goat gestation with inputs, formulas, and instant results.
๐งฎGuinea Pig Pregnancy Calculator โ Due Date
Calculate guinea pig pregnancy with inputs, formulas, and instant results.
๐งฎLlama Gestation Calculator
Calculate llama gestation with inputs, formulas, and instant results.
๐งฎMare Gestation Calculator
Calculate mare gestation with inputs, formulas, and instant results.