I'm trying to perform Fisher's exact test in R. I'm calculating odds ratio like this

$$\frac{(\text{no. of successes in my set}) \cdot (\text{no. of failures in background set})}{\text{(no. of successes in background set)} \cdot (\text{no. of failures in my set})}$$

In the denominator, I get 0 for some cases, because there are 0 failures in my set for some cases.

Can anyone tell me how to calculate p-values from odds ratio?

Also what does it mean if we say odds ratio should be greater or less than 1?

If I want to test over-representation in my set against the background set what should be the odds ratio and how can I calculate that?

  • 1
    $\begingroup$ Odds ratios and Fisher's exact test are not the same thing. The function for using Fisher's exact test in R is fisher.test. A description of how it computes the p-values is found in the help file ?fisher.test. See also en.wikipedia.org/wiki/Odds_ratio#Statistical_inference for statistical inference on odds ratios. $\endgroup$
    – MånsT
    Jan 24, 2012 at 14:40
  • $\begingroup$ Is there a way to calculate p-values from odds ratio?In fisher.test I don't understand the alternative hypothesis argument. It says alternative hypothesis must be one of "two.sided", "greater" or "less" and that the alternative for a one-sided test is based on the odds ratio, so alternative = "greater" is a test of the odds ratio being bigger than or? what does less mean?I want to calculate enrichment in my set and if I select greater, it gives me very big p-values most of which are 1 and as much as I know low p-values are significant. If I select less, it gives me small p-values.I'm confused. $\endgroup$
    – diana
    Jan 24, 2012 at 15:14
  • $\begingroup$ @diana Please register your account here, then I'll try to help you regaining ownership of your post. $\endgroup$
    – user88
    Jan 25, 2012 at 12:22
  • $\begingroup$ see stats.stackexchange.com/questions/21752/… about the alternative argument of fisher.test() in R. About the odds ratio you have to understand the statistical model behind Fisher's test. Observations are assumed to be the realizations of two independent binomial random variables, each binomial variable has a "probability of success" parameter and the question is about the comparison of the two probabilities of success $\endgroup$ Feb 24, 2012 at 19:47

1 Answer 1


You can't directly test significance of the odds ratio, instead you have to take log(OR) and then use the standard error $se = (\frac{1}{n_{00}} + \frac{1}{n_{01}} +\frac{1}{n_{10}} + \frac{1}{n_{11}})^.5$

and log(OR) is approximately distributed $\mathcal{N}(log(OR), \sigma^2)$

but that is asymptotic.

For Fisher's, you probably want two-sided option


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.