Relative Risk Calculator
Result
Relative risk (RR)
- Odds ratio (OR)
- 1.7143
A relative risk calculator compares how often an outcome occurred in two groups. Type the number of cases and the group size for each, and it returns the risk ratio — the risk in the exposed group divided by the risk in the control group. A value of 1 means the two groups were equally likely to experience the outcome, above 1 means the exposed group was more likely, and below 1 means less likely. The page also returns the odds ratio, because that is the number many studies actually report and it is not the same thing. The two agree when the outcome is rare and drift apart as it becomes common: in a cohort study of a frequent outcome the odds ratio can be half again as large as the risk ratio, and reading one as the other is a standard way to overstate a finding. Both come from the same four counts, and since those counts are on screen, every step can be checked by hand.
Formula
RR = (a / n₁) ÷ (c / n₂) OR = (a · d) / (b · c)
- a
- Cases in the exposed group — the people who had both the exposure and the outcome. It is the numerator of the first risk in the ratio, and it is also the exposed group's contribution to the odds ratio, which is why one set of counts feeds both answers
- n₁
- The size of the exposed group, cases plus non-cases. The risk is the count divided by this total, so the same thirty cases mean something very different out of a hundred than out of ten thousand — the risk ratio is a comparison of rates, not of counts, and the group sizes are what make the two comparable
- c
- Cases in the unexposed — the control — group. With a and c in hand the two risks can be written down directly, and the ratio is their quotient. The page refuses to compute anything if this is zero, and the refusal is deliberate: a control group with no cases gives a risk of zero, and dividing by it is undefined rather than infinite
- n₂
- The size of the unexposed group. The two group sizes need not be equal, and often are not — a cohort study may follow far more unexposed than exposed people, and the formula handles that without adjustment because each risk is computed within its own group
- b, d
- The non-cases in each group, which the page derives rather than asks for. They appear only in the odds ratio, where b = n₁ − a and d = n₂ − c. Deriving them is what makes the four inputs impossible to contradict: four free cells could describe a table in which the cases outnumber the group
Use it when you have counts from two groups followed forward and want the ratio of their risks — the effect size a cohort study is built to estimate. The two outputs answer subtly different questions and the choice between them is usually made by the study design rather than by preference. The risk ratio is the more interpretable of the two: 2 means the exposed group had twice the risk, and that sentence needs no explanation. The odds ratio is the one that comes out of a case-control study, where the proportion of cases is fixed by the researcher and the risks therefore cannot be estimated at all — only the odds ratio is recoverable, and it is also what logistic regression reports. When the outcome is rare the two are close enough that the odds ratio can be read as a risk ratio without much damage, and this is the standard justification for doing so. When the outcome is common they diverge, always in the same direction: the odds ratio is further from 1 than the risk ratio, so a protective exposure looks more protective and a harmful one looks more harmful. This page computes both from the same table so the gap can be seen rather than assumed away. Read it with the design in mind: association is not causation, and nothing in these four numbers distinguishes an exposure that caused the outcome from one that merely travelled with it.
Worked examples
The default: 30 of 100 exposed, 20 of 100 unexposed
- Risk in the exposed group: 30 / 100 = 0.30, or 30%
- Risk in the unexposed group: 20 / 100 = 0.20, or 20%
- Risk ratio: 0.30 / 0.20 = 1.5 — the exposed group's risk is half again as large
- Non-cases derived: b = 70 and d = 80, so the odds ratio is (30 × 80) / (70 × 20) = 2400 / 1400 = 1.7143
The two answers differ by 14% on an outcome this common, and seeing both is the reason the page computes both. The risk ratio says 50% more risk; the odds ratio says 71% higher odds. Neither is wrong — they are different quantities — but a report that quotes 1.71 as "a 71% increase in risk" has crossed the two, and that is one of the commonest errors in reading medical and social-science findings. Note also that equal group sizes are not required and were chosen here only to make the percentages round.
A stronger association widens the gap between the two measures
- Risk in the exposed group: 45 / 150 = 0.30
- Risk in the unexposed group: 15 / 150 = 0.10
- Risk ratio: 0.30 / 0.10 = 3, a threefold risk
- Odds ratio: (45 × 135) / (105 × 15) = 6075 / 1575 = 3.8571
At a risk ratio of 3 the odds ratio has reached 3.86, and the absolute gap is now nearly a full unit rather than the 0.21 of the previous example. The pattern is systematic rather than accidental: the odds ratio always sits further from 1, and the distance grows with both the strength of the association and the frequency of the outcome. This is why the rare-outcome rule of thumb is worth remembering — it is not a small technical caveat but the difference between reporting a 286% rise in odds and a 200% rise in risk.
An exposure associated with less risk
- Risk in the exposed group: 10 / 100 = 0.10
- Risk in the unexposed group: 25 / 100 = 0.25
- Risk ratio: 0.10 / 0.25 = 0.4 — a 60% reduction in risk
- Odds ratio: (10 × 75) / (90 × 25) = 750 / 2250 = 0.3333, a 67% reduction in odds
The direction works the same way below 1: the odds ratio is further from 1 than the risk ratio, so the exposure looks more protective than it is. It is worth stating the reduction carefully in either framing. A risk ratio of 0.4 means the risk fell by 60%, not that it fell to 60% — the two readings differ by a factor that grows quickly as the ratio moves away from 1, and a report that conflates them can make a modest effect sound dramatic or the reverse.
A rare outcome, where the two measures nearly coincide
- Risk in the exposed group: 2000 / 100000 = 0.02, or 2%
- Risk in the unexposed group: 1000 / 100000 = 0.01, or 1%
- Risk ratio: 0.02 / 0.01 = 2
- Odds ratio: (2000 × 99000) / (98000 × 1000) = 198000000 / 98000000 = 2.0204 — within 1% of the risk ratio
The rare-outcome approximation is visible here as arithmetic rather than as a rule to memorise. At a 2% risk the non-cases outnumber the cases so heavily that dividing by the non-case count is nearly the same as dividing by the group total, and the odds ratio collapses onto the risk ratio. These group sizes are also the realistic shape of a cohort study — a hundred thousand people followed to observe two thousand events — whereas the previous examples used small round numbers to keep the percentages readable.
Limitations
The page returns a ratio and makes no claim about whether the exposure caused the outcome. A risk ratio of 3 says the exposed group had three times the risk; it does not say the exposure produced that risk, and the four counts cannot distinguish a cause from a marker that happens to travel with one — the classic case being a variable associated with both the exposure and the outcome. It also assumes the two groups were followed for the same length of time, or that the counts have already been converted to a common period. Incidence accumulates, so a group observed for two years will have roughly twice the cases of an otherwise identical group observed for one, and nothing in the inputs reveals that. The zero-cell refusal is a deliberate limit rather than an oversight: adding a small constant to every cell would make the answer depend on a fabricated half-person, and the page declines instead so the user can see that the data is too thin. Case-control data is the last boundary. In that design the researcher sets how many cases to collect, so the proportion of cases in each group is an artefact of the sampling, and the risk ratio computed from those counts would be meaningless — the odds ratio survives because it is symmetric, which is exactly why it, and not the risk ratio, is the measure case-control studies report.
Frequently asked questions
- What is the difference between relative risk and odds ratio?
- Relative risk is a ratio of probabilities and odds ratio is a ratio of odds, and the two diverge as the outcome becomes more common. With risks of 30% and 20% the risk ratio is 1.5 while the odds ratio is 1.7143; with risks of 2% and 1% they are 2 and 2.0204. The odds ratio is always further from 1, so a harmful exposure looks more harmful and a protective one looks more protective. When the outcome is rare the difference is negligible, which is the basis of the well-known shortcut of reading an odds ratio as a risk ratio. That shortcut is safe for a disease that affects one person in a thousand and unsafe for an outcome that affects one in three.
- Why does the page refuse when the control group has no cases?
- Because the risk in that group is zero and the risk ratio would divide by it. Some software handles this by adding a small number to every cell — the Haldane–Anscombe correction — but that makes the answer depend on an invented half-person, and the result moves noticeably when the counts are small, which is exactly when the problem arises. The page returns an error instead so that the underlying issue is visible: with no cases among the controls, the data cannot bound the effect from above, and any finite number would be an artefact of the correction rather than a finding. Collecting more data is the only real repair.
- Can I use this on case-control data?
- The odds ratio, yes; the relative risk, no. In a case-control study the researcher decides how many cases and how many controls to enrol, so the proportion of cases in each group is set by the sampling design rather than observed. That makes the two risks meaningless as estimates — but the odds ratio is unaffected, because it is symmetric in cases and controls: swapping the rows and columns of the table leaves it unchanged. This is precisely why case-control studies report odds ratios, and why a risk ratio computed from their counts should not be interpreted even though the arithmetic runs.
- What does a relative risk of exactly 1 mean?
- It means the two groups had the same risk in this sample, so the exposure shows no association with the outcome. It does not mean there is no association in the population — a sample can easily produce a ratio of exactly 1, or any other value, while the true ratio differs. That is what a confidence interval around the ratio is for, and it is why a study reporting only the point estimate is incomplete. The page deliberately stops at the estimate and its companion measure: an interval requires a standard error for the log ratio, which is a further computation rather than a different reading of the same four counts.
- Does a relative risk of 3 mean the exposure triples my risk?
- It means the exposed group's risk was three times the unexposed group's in this study. Whether that translates into a large change in your own risk depends on the baseline, which the ratio does not carry. If the unexposed risk is 1 in 100,000, tripling it takes it to 3 in 100,000, which is still small; if it is 1 in 100, tripling it is a change worth acting on. This is the difference between relative and absolute risk, and it is why a study can report a striking-sounding ratio for an outcome that remains rare. Always ask for the two underlying risks alongside the ratio.
- Why are the four inputs cases and totals rather than four cells?
- Because four free cells can describe an impossible table. If the page asked for all four counts separately, nothing would stop a user from entering 30 cases out of 100 and 70 non-cases out of 100 in the same group — a table whose parts contradict each other, which would compute without complaint and produce a number with no meaning. Asking for the cases and the group total per group fixes the other two cells, so the non-case counts used by the odds ratio are always consistent with the risks used by the risk ratio. The cost is one fewer input, and the benefit is that an incoherent table is unrepresentable rather than merely unlikely.
References
- 3.1 Terminology — Introductory Statistics 2e (probability as a long-run proportion, which is what each group's risk is and what makes the ratio of two of them meaningful) — OpenStax (Rice University)
- 1.3.6.1. What is a Probability Distribution — e-Handbook of Statistical Methods (a count divided by a group total as an estimated probability, and the sampling variability that estimate carries) — National Institute of Standards and Technology (NIST)