[R] Fisher's Exact Test

Partha Bagchi Partha_Bagchi at hgsi.com
Wed Feb 17 16:57:41 CET 1999

Thanks for your prompt reply. I have installed the latest ctest and do get the
same answer as you.

From: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> AT INTERNET on 02/12/99
      10:16 PM

To:   Partha Bagchi/Hgsi
cc:   <r-help at stat.math.ethz.ch> AT INTERNET at cc
Subject:  Re: [R] Fisher's Exact Test

partha_bagchi at hgsi.com writes:

> Appology in advance if this has been asked and answered. I am getting
different > answers using Fisher's exact test in the package ctest. For example:
> x_cbind(c(8, 22), c(31, 29))
> fisher.test(x)
>     Fisher's Exact Test for Count Data
> data:  x
> p-value = 0.04024
> alternative hypothesis: two.sided
> However, in SAS or other packages on the net the answer I get is p-value= >
> Is this a result of the Clarkson, Fan & Joe (1993) improvement or am I doing >
something fundamentally wrong?
> (the above is only an example - I get different (from R) answers when I use >
different input matrices).

With the most recent ctest, I actually get

> fisher.test(x)

         Fisher's Exact Test for Count Data

data:  x
p-value = 0.02664
alternative hypothesis: two.sided

The confusion is caused by this:

> fisher.test(x,alt="l")

         Fisher's Exact Test for Count Data

data:  x
p-value = 0.02012
alternative hypothesis: less

So the old definition of the p-value is 2 * (one-sided p), whereas the new one
sums those point probabilities that are less than or equal to the observed one.

Mind you, there's a paper by Yates lying somewhere in my "must read some time"
stack where he argues that the 2 * p procedure is more correct...

   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list