# Interpreting zero odds ratio from Fisher's exact test

I did fisher's exact test and I got an odds ratio equal to zero. Can you please clarify what it means? I want to plot the odds ratio but don't know how to deal with the zero and INF values. below are the data and the test:

z <- matrix(c(69,13,33,0),nrow=2)
f <- fisher.test(z)
f


This is the output:

    Fisher's Exact Test for Count Data

data:  z
p-value = 0.01845
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
0.000000 0.742875
sample estimates:
odds ratio
0


Any help is very appreciated.

If in a 2-by-2 table, we let $$n_{11}$$ be the counts in (1,1) cell, $$n_{12}$$ the counts in the (1,2) cell, $$n_{21}$$ those of cell (2,1) cell and $$n_{22}$$ those of cell (2,2), then the sample odds ratio is defined by

$$\hat\theta = \frac{n_{11}n_{22}}{n_{12}n_{21}}.$$

If any of $$n_{ij}$$ is zero, then $$\hat\theta$$ equals 0 or $$\infty$$ (it is undefined if both entries in a row or in a column are zero). Because these outcomes have positive probability, then the expected value and variance of $$\hat\theta$$ are not defined. A better well-behaved estimator is $$\tilde\theta = \frac{(n_{11}+0.5)(n_{22}+0.5)}{(n_{12}+0.5)(n_{21}+0.5)}$$

Both $$\hat\theta$$ and $$\tilde\theta$$ have the same asymptotic normal distribution around the true odds-ratio $$\theta$$. Unless the sample size is quite large, however, the distributions of both $$\tilde\theta$$ and $$\hat\theta$$ are highly skewed. The log transform, having an additive rather than multiplicative structure, converges more rapidly to normality. An estimated standard error for $$\log\hat\theta$$ is

$$\hat{\rm{se}}(\log\hat\theta) = \left(\frac{1}{n_{11}}+\frac{1}{n_{12}}+\frac{1}{n_{21}}+\frac{1}{n_{22}}\right)^{1/2},$$

and thus by the large sample normality of $$\log\hat\theta$$

$$\log\hat\theta \pm z_{\alpha/2}\hat{\rm{se}}(\log\hat\theta).$$ provides an approximate confidence interval for $$\log\hat\theta$$. The confidence interval for $$\hat\theta$$ can be obtained by exponentiating the limits of the above intervals. A similar interval can be obtained using $$\tilde\theta$$ in place of $$\hat\theta$$.

However, when $$\hat\theta = 0$$ or $$\hat\theta = \infty$$, this interval cannot be applied. When $$\hat\theta = 0$$, one should take 0 as the lower limit and when $$\hat\theta = \infty$$ one should take $$\infty$$ as the upper limit. For the other bound you can use the above formula following some adjustment, such as replacing $$n_{ij}$$ by $$n_{ij}+0.5$$ in the estimator and standard error. Other methods are also possible, such as methods based on score function or conditional maximum likelihood estimation.

As for the odd-ratio estimate provided by fisher.test, the help page (?fisher.test) says

estimate an estimate of the odds ratio. Note that the conditional Maximum Likelihood Estimate (MLE) rather than the unconditional MLE (the sample odds ratio) is used. Only present in the 2 x 2 case.

This means that the odd-ratio provided by fisher.test is derived through an alternative estimator (here conditional maximum likelihood, which is a kind of maximum likelihood estimator) which need not coincide with the sample odds ratio $$\hat\theta$$ or $$\tilde\theta$$.

Here is a simple example that supports this claim.

fisher.test(matrix(c(69,13,33,23), ncol=2))

Fisher's Exact Test for Count Data

data:  matrix(c(69, 13, 33, 23), ncol = 2)
p-value = 0.001425
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
1.556881 8.947718
sample estimates:
odds ratio
3.66139

# sample odds-ratio estimate
> 69*23/(13*33)
[1] 3.699301


As you can see, the two estimates are not exactly the same although they are pretty close.

If you want to dive deeper into this subject I suggest having a look at Agresti's Categorical Data Analysis book.

• Is there any way to correct for those odd ratios with zero? like adding 1 to all of the cells ? is this correct way to solve this problem? Feb 16, 2023 at 13:45
• @MarwahAl-kaabi , look up the Haldane-Anscombe correction for odds ratio, which adds 0.5 to each cell when there are 0 or low counts. There are other methods as well. Feb 16, 2023 at 14:30