Paritian

Statistics

Relative Risk and Odds Ratio Calculator (2×2 Table)

Relative risk, odds ratio, risk difference and number needed to treat from a 2×2 table, with 95 % confidence intervals.

Results

Relative risk 2.0000
Relative risk, 95 % interval — lower 1.1489
Relative risk, 95 % interval — upper 3.4817
Odds ratio 2.4286
Odds ratio, 95 % interval — lower 1.2110
Odds ratio, 95 % interval — upper 4.8704
Risk difference 15.00 %
Number needed to treat or harm (1 ÷ difference) 6.7

What this tool does

A 2×2 table compares how often an outcome happens with and without an exposure — a treatment, a habit, a risk factor. Relative risk compares the two rates directly and is what cohort studies and trials report; the odds ratio is what case-control studies can estimate, and it is close to the relative risk only when the outcome is rare. If a 95 % interval includes 1 the data are compatible with no effect. The risk difference and number needed to treat say how much an effect matters in practice, which a ratio alone hides. Intervals use the usual log method and need all four counts above zero.

Formula

RR = [a ÷ (a + b)] ÷ [c ÷ (c + d)] · OR = a d ÷ (b c) · 95 % CI = exp(ln θ ± 1.96 × SE)

Variables

SymbolMeaningUnit
aExposed, with the outcome (a)—
bExposed, without the outcome (b)—
cNot exposed, with the outcome (c)—
dNot exposed, without the outcome (d)—
RRRelative risk—
RLRelative risk, 95 % interval — lower—
RHRelative risk, 95 % interval — upper—
OROdds ratio—
OLOdds ratio, 95 % interval — lower—
OHOdds ratio, 95 % interval — upper—
RDRisk difference%
NNNumber needed to treat or harm (1 ÷ difference)—

Worked example

  • Exposed, with the outcome (a)30
  • Exposed, without the outcome (b)70
  • Not exposed, with the outcome (c)15
  • Not exposed, without the outcome (d)85
  • Relative risk2.0000
  • Relative risk, 95 % interval — lower1.1489
  • Relative risk, 95 % interval — upper3.4817
  • Odds ratio2.4286
  • Odds ratio, 95 % interval — lower1.2110
  • Odds ratio, 95 % interval — upper4.8704
  • Risk difference15.00 %
  • Number needed to treat or harm (1 ÷ difference)6.7

Limitations

  • Standard deviation and variance are calculated for a sample (dividing by n − 1). For a full population, divide by n instead.
  • This tool is informational only. It does not diagnose, treat or replace a qualified health professional. Speak to a doctor before making decisions about your health.