# How to calculate odds ratio and p-values for Fisher's test?

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?

• 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. Jan 24 '12 at 14:40
• 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. Jan 24 '12 at 15:14
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)$