**From:** Achim Zeileis (*zeileis@ci.tuwien.ac.at*)

**Date:** Wed 26 Feb 2003 - 18:42:25 EST

**Next message:**Michel ARNAUD: "[R] IDW (inverse distances weighted)"**Previous message:**Petr Pikal: "Re: [R] multiple plot overlay - dataframe"**In reply to:**Andrew Criswell: "[R] Odds ratio in fisher.test()"

Message-id: <200302260742.h1Q7gPOe021167@thorin.ci.tuwien.ac.at>

On Wednesday 26 February 2003 05:10, Andrew Criswell wrote:

*> 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.
*

*>From help(fisher.test):
*

estimate: an estimate of the odds ratio. Note that the conditional

Maximum Likelihood Estimate (MLE) rather than the

unconditional MLE (the sample odds ratio) is used. Only

present in the 2 by 2 case.

Look at the code to see how it is computed.

Z

*> > 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
*

*>
*

*> ______________________________________________
*

*> R-help@stat.math.ethz.ch mailing list
*

*> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
*

______________________________________________

R-help@stat.math.ethz.ch mailing list

http://www.stat.math.ethz.ch/mailman/listinfo/r-help

**Next message:**Michel ARNAUD: "[R] IDW (inverse distances weighted)"**Previous message:**Petr Pikal: "Re: [R] multiple plot overlay - dataframe"**In reply to:**Andrew Criswell: "[R] Odds ratio in fisher.test()"

*
This archive was generated by hypermail 2.1.3
: Tue 01 Jul 2003 - 09:11:23 EST
*