A/B testing
Odds Ratio Calculator
How much more likely an outcome is in one group than another, on the odds scale.
How to read this result
Odds are not probability. A probability of 0.75 is odds of 3 to 1. The odds ratio compares the odds in two groups, and an odds ratio of 2 does not mean the outcome is twice as likely — it means the odds are twice as large, which is a smaller effect on probability whenever the outcome is common.
Read the interval, and note where 1 sits. The null value for a ratio is 1, not 0. An interval that includes 1 means the data are consistent with no association.
The interval is asymmetric because it is computed on the log scale. Odds ratios are skewed — they run from 0 to 1 for negative associations and 1 to infinity for positive ones — so the arithmetic is done in logs and transformed back.
The odds ratio and the relative risk are both reported, and they differ. With a rare outcome they are close; with a common one the odds ratio is always further from 1. Reporting one as the other systematically overstates the effect, and it happens constantly in press coverage.
The formula
- the first group's counts with and without the outcome
- the second group's
The standard error is computed on the log scale, which is where the sampling distribution is approximately normal.
Worked example
Exposure and outcome in two groups of a hundred
Of 100 exposed people, 30 have the outcome. Of 100 unexposed, 15 do. How much does exposure change the odds?
| outcome | no outcome | |
|---|---|---|
| exposed | 30 | 70 |
| unexposed | 15 | 85 |
- The odds in each group.exposed 30/70 = 0.4286 unexposed 15/85 = 0.1765
- Their ratio.OR = 0.4286 / 0.1765 = 2.4286
- The standard error of ln(OR).√(1/30 + 1/70 + 1/15 + 1/85) = 0.3550
- The interval on the log scale, then exponentiated.exp(0.8873 ± 1.96 × 0.3550) = 1.211 to 4.870
- For comparison, the relative risk.0.30 / 0.15 = 2.00
The odds ratio is 2.43 and the risk ratio 2.00. With an outcome this common — 30% and 15% — the two differ by a fifth, and quoting 2.43 as “more than twice as likely” would be wrong.
Checked against the standard log-odds interval, computed in R.
The calculator above is loaded with these numbers by the Load the worked example button.
Assumptions, and when to use something else
- Counts, from independent observations, cross-classified into a 2×2 table.
- Adequate cell counts for the log-normal approximation. With any cell below about 5, the exact interval from Fisher's exact test is preferable.
- A zero cell needs a correction. Adding 0.5 to every cell (Haldane-Anscombe) is the standard fix and is applied by default; the result should be treated as approximate.
Odds ratios can be computed from case-control studies, where relative risk cannot — the row totals are fixed by design, so risk is not estimable. That property is the main reason the odds ratio is so widely used in epidemiology.
- You want risk rather than oddsRelative riskMore intuitive when the rows are the groups being compared and the outcome is common.
- The counts are smallFisher's exact testExact p-value and an exact conditional interval for the odds ratio.
- You want to test the associationChi-square testThe significance test for the same table.
- You have predictors as well as groupsLogistic regressionAdjusted odds ratios, controlling for other variables.
Questions people ask
What is the difference between an odds ratio and relative risk?
Relative risk compares probabilities; the odds ratio compares odds. When the outcome is rare they are nearly identical. When it is common the odds ratio is further from 1 — in the example above, 2.43 against 2.00 — so reporting an odds ratio as if it were a risk ratio overstates the effect.
What does an odds ratio of 1 mean?
No association: the odds are the same in both groups. Above 1 means higher odds in the first group, below 1 means lower. A confidence interval spanning 1 means the data cannot establish a direction.
Why is the confidence interval not symmetric?
Because it is computed on the log scale and transformed back. Odds ratios are bounded below by 0 and unbounded above, so a symmetric interval would be wrong — and could run negative.
What do I do about a zero cell?
Add 0.5 to every cell — the Haldane-Anscombe correction, applied by default here. Without it the odds ratio is 0 or infinite. For small tables generally, Fisher's exact test gives an exact interval that handles zeros properly.