There does not appear to have been a lot of development related to the tests
for classification-type data (generally, not just S). A similar, and
slightly more problematic oversight exists in the code for the McNemar
Chi-square test (for paired observations). I think the possibility of 0
occurrences associated with a degree of freedom for a subject was generally
overlooked across these sorts of tests, with some differences in the way the
problem expresses itself between tests (Fisher, McNemar, t, etc). Also much
of the originating work concentrated on 2x2 classifications, such that some
tests may work for 0 observations in a 2x2 but not at higher dimensions. It
would be helpful if the statistical community renewed interest in these
tests. I was able to modify the McNemar function to associate the
appropriate degrees of freedom for instances of 0 observations, but although
the fix is suitable for the specific situation I was addressing, it would
not be adequate as a general application. We would want these tests to
address the issue of whether the sampled number of categories truly reflects
the real population of possibilities (e.g. what if we have 0 counts for both
subjects in a category, but know that one or both subjects in the real
population have representatives).
> Mark Fowler
> Marine Fish Division
> Bedford Inst of Oceanography
> Dept Fisheries & Oceans
> Dartmouth NS Canada
> fowlerm@mar.dfo-mpo.gc.ca
>
-----Original Message-----
From: Austin, Matt [mailto:maustin@amgen.com]
Sent: August 25, 2004 11:00 PM
To: 'sundar.dorai-raj@PDF.COM'; Salomon Minkin
Cc: S-PLUS Newsgroup
Subject: Re: [S] Bug in Fisher Exact test?
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
--------------------------------------------------------------------
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
|