Solved – How to calculate odds ratio and p-values for Fisher’s test

fishers-exact-testodds-ratior

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?

Best Answer

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