About the Relative Risk Calculator
This calculator computes relative risk and odds ratio from a 2x2 exposure-by-outcome table, the two core measures epidemiologists and researchers use to quantify how strongly an exposure is associated with an outcome. It is built for cohort-style data where you know the full count of exposed and unexposed subjects, split by whether the event occurred.
How It Works
You enter four counts: exposed subjects with the event (a) and without it (b), and unexposed subjects with the event (c) and without it (d). The calculator divides each group's event count by its own row total to get risk in the exposed group and risk in the unexposed group, then divides the two to get relative risk. Odds ratio is computed separately, directly from the cross-product of the four cells rather than from the risk percentages.
Formula & Methodology
To work this by hand, first total each row: exposed total is a+b, unexposed total is c+d. Divide a and c by their respective totals to get the two risk percentages, then divide the exposed risk by the unexposed risk for RR. For the odds ratio, skip the risk calculation entirely and just cross-multiply: a times d, divided by b times c.
Examples
Cohort study with 100 per group
With a=30, b=70 (100 exposed) and c=15, d=85 (100 unexposed), risk in the exposed group is 30/100 = 30% and risk in the unexposed group is 15/100 = 15%, giving a relative risk of 2.0 and an odds ratio of (30 x 85)/(70 x 15) = 2550/1050 = 2.429.
Smaller exposed group
With a=8, b=42 (50 exposed) and c=20, d=180 (200 unexposed), risk is 8/50 = 16% in the exposed group versus 20/200 = 10% in the unexposed group, giving a relative risk of 1.6 and an odds ratio of (8 x 180)/(42 x 20) = 1440/840 = 1.714.
Advantages
- Reports both relative risk and odds ratio side by side, so you can present the more intuitive relative risk when group sizes are known and fall back on odds ratio for case-control comparisons.
- Shows the underlying risk percentage for each group individually, not just the ratio between them, making it easier to sanity-check the inputs.
- Applies input guards that catch impossible or undefined table configurations before returning a misleading number.
Common Mistakes
- Reading an odds ratio as if it were a relative risk when the outcome is common, which overstates the strength of association since OR diverges from RR as event rates rise.
- Swapping the exposed and unexposed rows, which flips the direction of the association and can turn an apparent risk factor into an apparent protective factor.
- Using relative risk from case-control data where true population risk is unknown, when odds ratio is the statistically appropriate measure for that study design.
Edge Cases to Watch For
- Both group totals (a+b and c+d) must be greater than zero, since risk requires dividing by a nonzero group size.
- The product b x c cannot be zero, because the odds ratio formula divides by it directly.
- Risk in the unexposed group cannot be zero, since relative risk divides by it.
- When the outcome is rare in both groups, relative risk and odds ratio tend to sit close together numerically even though they are computed differently; as the outcome gets more common, the odds ratio moves further from 1 than the relative risk does.
Common Use Cases
- Epidemiologists and public health analysts quantifying the strength of association between an exposure and a health outcome.
- Researchers summarizing results from a cohort or case-control study for a report or publication.
- Students and instructors working through 2x2 contingency table problems in an introductory epidemiology or biostatistics course.