[R] Odds ratio in fisher.test()

Andrew Criswell arc at arcriswell.com
Wed Feb 26 05:13:02 CET 2003


Hello:

Please help me through my confusion. I am having trouble reconciling the
difference between what I believe is the conventional definition of an
odds ratio for a 2-by-2 table and the output produced by fisher.test()
in R. Consider the following example:

> Discrim <- matrix(c(1,10,24,17), 
+            nr = 2,
+            dimnames = list(AGE    = c('young', 'old'),
+                            EMPLOY = c('fired', 'kept')))
> Discrim
       EMPLOY
AGE     fired kept
  young     1   24
  old      10   17

The conventional odds ratio is computed as

> (1 * 17) / (24 * 10)
[1] 0.07083333

Why is it, when I use fisher.test(), I get an estimated odds ratio like
that reported below? There, the difference seems slight, but with other
cases it can be quite large.

> fisher.test(Discrim, alternative = 'two.sided')

        Fisher's Exact Test for Count Data

data:  Discrim 
p-value = 0.005242
alternative hypothesis: true odds ratio is not equal to 1 
95 percent confidence interval:
 0.001573963 0.606416320 
sample estimates:
odds ratio 
0.07407528


Thanks,
ANDREW




More information about the R-help mailing list