🔷Odds Ratio and Relative Risk Calculator

Odds ratio, relative risk, intervals and risk difference from four cells

How to use the odds ratio and relative risk calculator

Fill in the four cells of a 2×2 table and the calculator returns both the odds ratio and the relative risk. Relative risk divides the risk in the exposed group by the risk in the unexposed group, which reads naturally, while the odds ratio compares the odds of each group and is what case-control studies have to use because they cannot measure risk directly. The two agree when events are rare and drift apart as risk climbs.

Confidence intervals are built on the log scale, where the standard error is well behaved, and then exponentiated back. An interval that spans 1 means the difference cannot be called real, so that verdict is spelled out. The risk difference and its reciprocal, the number needed to treat or harm, appear too, and the reciprocal row hides itself when the risk difference is zero and the reciprocal would be infinite.

If any one of the four cells is zero the odds ratio collapses to zero or infinity and no interval exists. The default is therefore to report it as undefined, and switching on the Haldane-Anscombe correction adds 0.5 to every cell instead. The correction only fires when a zero cell is actually present and is only reported when it fired, so no note means no correction.

Frequently asked questions

How do the odds ratio and relative risk differ?

Relative risk is a ratio of risks and the odds ratio is a ratio of odds. They are close when events are rare and the odds ratio stretches further as risk grows.

Why does a zero cell stop the calculation?

A zero puts a zero in the numerator or denominator, so the odds ratio becomes zero or infinity and the log used for the interval is undefined. The correction adds 0.5 to each cell.

What does an interval that includes 1 mean?

One is the value for no association at all, so an interval containing it leaves the result short of statistical significance.