# [R] Fisher's Exact Test

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Feb 12 22:16:56 CET 1999

```partha_bagchi at hgsi.com writes:

> 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=
> 0.02664.
>
> 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```