# is there a bug in the calculation of the odds ratio in fisher.test?
# Nicholas Horton, [email protected] Fri Jan 22 08:29:07 EST 2010

x1 = c(rep(0, 244), rep(1, 209))
x2 = c(rep(0, 177), rep(1, 67), rep(0, 169), rep(1, 40))

or1 = sum(x1==1&x2==1)*sum(x1==0&x2==0)/
     (sum(x1==1&x2==0)*sum(x1==0&x2==1))

library(epitools)
or2 = oddsratio.wald(x1, x2)$measure[2,1]

or3 = fisher.test(x1, x2)$estimate

# or1=or2 = 0.625276, but or3=0.6259267!


I'm running R 2.10.1 under Mac OS X 10.6.2.

Nick

Nicholas Horton 
Department of Mathematics and Statistics, Smith College
Clark Science Center, Northampton, MA 01063-0001
http://www.math.smith.edu/~nhorton

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to