# Why do odds ratios from formula and R's fisher.test differ? Which one should one choose?

In the following example

> m = matrix(c(3, 6, 5, 6), nrow=2)
> m
[,1] [,2]
[1,]    3    5
[2,]    6    6
> (OR = (3/6)/(5/6))    #1
[1] 0.6
> fisher.test(m)        #2

Fisher's Exact Test for Count Data

data:  m
p-value = 0.6699
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
0.06390055 5.07793271
sample estimates:
odds ratio
0.6155891


I calculated the odds ratio (#1) "manually", 0.600; then (#2) as one of the outputs of the Fisher's exact test, 0.616.

Why didn't I get the same value?

Why do several ways of computing the odds-ratio exist, and how to choose the most appropriate one?

From the help page for fisher.test():

Note that the conditional Maximum Likelihood Estimate (MLE) rather than the unconditional MLE (the sample odds ratio) is used.

To add to the discussion here, it is useful to ask what exactly is conditioned on in this "conditional" likelihood. The Fisher test differs from other categorical analyses in that it considers all margins of the table to be fixed whereas the logistic regression model (and corresponding Pearson chi-square test which is the score test of the logistic model) only consider one margin to be fixed.

The Fisher test then considers the hypergeometric distribution as a probability model for the counts observed in each of the 4 cells. The hypergeometric distribution has the peculiarity that, since the distribution of the originating odds ratio is not continuous, you often obtain a different OR as a maximum likelihood estimate.

• I don't think your answer makes it clear how this particular likelihood might arise. If you model the data-generating process with a product-binomial, say, you get a different likelihood (& MLE) conditional on the marginal totals, from what you get if you model it with Wallenius' non-central hypergeometric distribution - the marginal totals are "considered fixed" in both cases. – Scortchi - Reinstate Monica Mar 3 '17 at 10:58

To answer your second question, biostats isn't my forte but I believe the reason for multiple odds ratio statistics is to account for sampling design and design of experiments.

I've found three references here that will give you a bit of understanding as to why there is a difference between conditional MLE vs unconditional for odds ratio, as well as other types.

• It'd be useful to summarize at least a little what those references have to say. – Scortchi - Reinstate Monica Mar 3 '17 at 11:00
• @Scortchi, agreed. I've been busy with work and only had the chance to read through the first page or two of each. I'll add a summary of each this weekend. – Jon Mar 3 '17 at 16:29
• @Jon If you could, it would be useful to add that brief summary – Glen_b Jul 5 '17 at 12:57
• @Jon I only asked one question. It was bli who added a second question 4 years after I posted my original question. I'm not reversing bli's annoying edit as you referenced the second question, but I'm not sure how to accept an answer any more. – winerd Dec 21 '17 at 19:12