Just looking at this quickly it seems that the S-Plus implementation seems
to have some problems with the number of rows is less than the number of
columns. I did a few (very limited) test cases and this was consistent if
there was a discrepancy. For example, just transpose your matrix and the
results are as expected.
--Matt
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu]On Behalf Of Sundar
Dorai-Raj
Sent: Wednesday, August 25, 2004 17:45 PM
To: Salomon Minkin
Cc: S-PLUS Newsgroup
Subject: Re: [S] Bug in Fisher Exact test?
Salomon Minkin wrote:
> I'm running Version 6.2 on Unix.
>
> I'm surprised that I'm getting zero p-values when I'm running the
> Fisher exact test on some 3 x 2 tables. Here are two examples:
>
>
>>fisher.test(matrix(c(0,1,2,0,0,3),nrow=2))
>
>
> Fisher's exact test
> data: matrix(c(0, 1, 2, 0, 0 ,3), nrow = 2)
> p-value = 0
> alternative hypothesis: two.sided
>
>
>>fisher.test(matrix(c(0,5,3,1,0,1),nrwo=2))
>
>
> Fisher's exact test
> data: matrix(c(0, 5, 3, 1, 0 ,1), nrow = 2)
> p-value = 0
> alternative hypothesis: two.sided
>
> Clearly, there is a positive probability of observing these particular
> tables keeping the margins fixed. According to my hand calculations,
> the probability of observing the first table is 0.067, and for the
> second table
> the probability is 0.033.
>
> Why do I get a p-value of zero?
>
In R, I get your hand-calculated answers. Not sure how it is different
in S-PLUS.
R> fisher.test(matrix(c(0,1,2,0,0,3),nrow=2))
Fisher's Exact Test for Count Data
data: matrix(c(0, 1, 2, 0, 0, 3), nrow = 2)
p-value = 0.06667
alternative hypothesis: two.sided
R> fisher.test(matrix(c(0,5,3,1,0,1),nrow=2))
Fisher's Exact Test for Count Data
data: matrix(c(0, 5, 3, 1, 0, 1), nrow = 2)
p-value = 0.03333
alternative hypothesis: two.sided
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|