Relative risk and odds ratio calculator
Enter the 2×2 table, get RR, OR and their confidence intervals.
Exposed (or treated) group
Unexposed (or control) group
What is relative risk?
The risk of an outcome in the exposed group divided by the risk in the unexposed group: RR = [a ÷ (a + b)] ÷ [c ÷ (c + d)]. With 20 of 100 exposed and 10 of 100 unexposed people affected, RR = 0.20 ÷ 0.10 = 2.0.
What is an odds ratio?
The odds of the outcome in one group divided by the odds in the other: OR = (a × d) ÷ (b × c). In the same example the odds are 20 : 80 and 10 : 90, so OR = 2.25.
How is the 95% confidence interval found?
On the log scale: ln(RR) ± 1.96 × SE, with SE = √(1/a − 1/(a+b) + 1/c − 1/(c+d)); for the odds ratio SE = √(1/a + 1/b + 1/c + 1/d). Here RR = 2.0 (0.99 to 4.05) and OR = 2.25 (0.99 to 5.09).
What does it mean if the interval includes 1?
The data are consistent with no difference between the groups at the 5% level — as in the example, even though the estimates are 2.0 and 2.25.
When are relative risk and odds ratio similar?
When the outcome is rare, the odds ratio is close to the relative risk. When the outcome is common, the odds ratio is further from 1 than the relative risk.
What is the absolute risk difference and the number needed to treat?
The risk difference is the risk in the exposed group minus the risk in the other group, and 1 ÷ |difference| is the number of people who must be exposed (or treated) for one extra (or one fewer) case. In the example below it is 10.0 percentage points, or about 10 people.
A worked example
Suppose 30 of 200 exposed people (30 with the outcome, 170 without) and 15 of 300 unexposed people (15 with, 285 without) develop the outcome. The risks are 30 ÷ 200 = 15.0% and 15 ÷ 300 = 5.0%, so RR = 3.00 with a 95% interval of 1.66 to 5.43. The odds are 30 : 170 and 15 : 285, so OR = 3.35 with an interval of 1.75 to 6.41. Because both intervals sit above 1, the data are not consistent with equal risk at the 5% level.
Relative or absolute?
A relative risk says how many times larger one risk is, not how large either one is. If 2 in 1,000 exposed and 1 in 1,000 unexposed people are affected, RR is 2.00 but the extra risk is only 0.1 percentage points. When the outcome is rare the odds ratio (2.00) is almost the same as RR. When it is common the two part ways: with 60 of 100 against 30 of 100, RR is 2.00 while OR is 3.50.
Common mistakes
Reading an odds ratio as if it were a risk ratio is a common mistake, and it overstates the effect when the outcome is common. Declaring “no effect” because the interval includes 1 is the second: it means the data are consistent with no difference, but also with a sizeable one if the interval is wide. Third, putting the counts in the wrong cells, for example swapping the exposed and unexposed rows, inverts the ratio. Finally, a relative risk from an observational study does not prove cause; confounding can produce one. Case-control studies fix the number of cases, so they support odds ratios rather than risks.
Sources: CDC, Principles of Epidemiology in Public Health Practice (Lesson 3, measures of risk, including risk ratio and odds ratio); the log-scale confidence intervals follow the standard Katz method. Related: sensitivity and specificity calculator, chi-square independence calculator, Fisher exact test calculator and confidence interval calculator.