Odds Ratio Calculator

Calculate odds ratio, relative risk, and confidence intervals from 2x2 contingency tables.

2×2 Contingency Table

Exposed / CaseNot Exposed / Control
Outcome Present
Outcome Absent

a = Number of exposed subjects with the outcome

b = Number of unexposed subjects with the outcome

c = Number of exposed subjects without the outcome

d = Number of unexposed subjects without the outcome

Formulas

Odds Ratio

The odds ratio is calculated as:

OR=a×db×cOR = \frac{a \times d}{b \times c}

Where:

  • a,b,c,da, b, c, d = Cells in the 2×2 contingency table

Relative Risk

The relative risk (risk ratio) is calculated as:

RR=a/(a+b)c/(c+d)RR = \frac{a/(a+b)}{c/(c+d)}

Where:

  • a/(a+b)a/(a+b) = Risk in the exposed group
  • c/(c+d)c/(c+d) = Risk in the unexposed group

Confidence Interval for Odds Ratio

The confidence interval is calculated using the log odds ratio:

ln⁥(OR)ÂązÎą/2×SE\ln(OR) \pm z_{\alpha/2} \times SE

Where the standard error (SE) is:

SE=1a+1b+1c+1dSE = \sqrt{\frac{1}{a} + \frac{1}{b} + \frac{1}{c} + \frac{1}{d}}

And the confidence interval for the odds ratio is:

CIOR=(eln⁥(OR)−zÎą/2×SE,eln⁥(OR)+zÎą/2×SE)CI_{OR} = (e^{\ln(OR) - z_{\alpha/2} \times SE}, e^{\ln(OR) + z_{\alpha/2} \times SE})