How it’s calculated
A 2×2 table compares an outcome across two groups. Fill in how many people in the exposed group did (a) and did not (b) have the outcome, and the same for the unexposed group (c and d). This calculator then gives three standard measures of association with confidence intervals.
| Outcome | No outcome | |
|---|---|---|
| Exposed | a | b |
| Not exposed | c | d |
Here z is 1.96 for 95% confidence (1.645 for 90%, 2.576 for 99%). The intervals are built on the log scale and then converted back, which is why they are not symmetric around the estimate.
Worked example (CDC, Principles of Epidemiology, Lesson 3): a = 100, b = 1,900, c = 80, d = 7,920. The risk in the exposed is 100 ÷ 2,000 = 0.05 and in the unexposed 80 ÷ 8,000 = 0.01, so RR = 5.0 and RD = 0.04. OR = (100 × 7,920) ÷ (1,900 × 80) = 792,000 ÷ 152,000 = 5.2. For the 95% intervals, SE(ln OR) = √(0.01 + 0.000526 + 0.0125 + 0.000126) = 0.1522, giving 3.87 to 7.02, and SE(ln RR) = √(0.01 − 0.0005 + 0.0125 − 0.000125) = 0.1479, giving 3.74 to 6.68.
When the outcome is rare, the OR is close to the RR. When it is common, the OR is farther from 1 than the RR. Case-control studies can only estimate the OR, not the risks. A zero cell makes the OR or RR 0 or undefined, so you can add 0.5 to each cell (the Haldane-Anscombe correction); the results are then approximate.
These are statistical associations in the data you enter. They do not show cause and effect, and this page is for learning, not for medical decisions.
Frequently asked questions
What is the difference between odds ratio and relative risk?
Relative risk compares probabilities (risk in the exposed ÷ risk in the unexposed). The odds ratio compares odds. They are similar when the outcome is rare, but the OR exaggerates the effect when the outcome is common.
How do I read the confidence interval?
If the interval for an OR or RR includes 1, the data are consistent with no association at that confidence level. For a risk difference, check whether the interval includes 0.
Which cell is which?
Rows are the exposure (exposed, unexposed) and columns are the outcome (yes, no). Swapping rows or columns changes the ratios, usually to their reciprocals, so decide which group is your reference before entering the data.
What do I do if a cell is zero?
The ratio may be 0 or undefined and the standard errors blow up. This calculator can add 0.5 to every cell (the Haldane-Anscombe correction) and labels the result as corrected. With very small counts, an exact method is better.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- CDC Principles of Epidemiology, Lesson 3 Section 5: Measures of Association (risk ratio and odds ratio) — U.S. Centers for Disease Control and Prevention
- STAT 226 Lecture 4: Difference of Proportions, Relative Risk, Odds Ratio (log RR standard error, Wald interval for p1 − p2) — University of Chicago
- Mike's Biostatistics Book, §7.6 Confidence intervals (standard error of ln OR and the exponentiated interval) — LibreTexts
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator