Dear Professor Mean, I have a data set where 94 out of 100 patients with cancer have activation of a gene, while 0 out of 50 of the controls have activation. When I compute the odds ratio, I get (94*50) / (6*0) = 4700 / 0 = ???. What should I do?

Whatever you do, don’t run that last calculation. Your computer will explode, it will take down the entire Internet with it, and we’ll all end up living in caves. Either that or you’ll get a brief error message.

Seriously, this happens all the time. Any positive number divided by zero is infinite. So simply state that the odds ratio is infinity. Go ahead and use the word, infinity, an abbreviation like Inf, or that sideways 8 symbol. Then use Fisher’s Exact test to calculate the statistical significance. Looking at your data, I think that a p-value is overkill here, but calculate it anyway to make things official. Here’s an example of what you might write:

There was a strong association between gene activation and cancer (OR=Infinity, P<0.0001).

There are also ways that you can place a confidence limit around this odds ratio, but it typically requires specialized software. Some people recommend that you add a small value to each cell (usually 0.5) before calculating the odds ratio. I can’t recommend that approach (too ad hoc), but will note that some people think it is a good solution.

This Blog post was added to the website on 2016-01-19 and was last modified on 2020-01-19. You can find similar pages at Measuring benefit and risk.