[R] categorical data analysis - fisher.exact for 2x2 and greater
Dr. Jeff Miller
jeffmiller at alphapoint05.net
Wed May 7 17:56:07 CEST 2008
Hi Simon and all,
I'm pretty sure that you are correct about this. I think it is a
misconception to say that the fisher exact test is only for a 2 by 2 table.
It is presented that way in textbooks because, for a 2x2 table, it is easy
to perform. For larger tables, it becomes complex quickly due to the rate
at which the permutations increase.
When I use it for larger tables, it is hit or miss as to whether R will be
able to do it. It's not uncommon to get an error implying that R is out of
memory.
Check out Agresti's Categorical Data Analysis on the use of the fisher exact
for larger than 2x2 tables, and check out the R archives (and Google search)
for all the posts about the error message people run into sometimes.
On April 29th, Marc Schwartz replied to my question about this as follows:
Take a look at the 'workspace' argument in ?fisher.test and review the
second paragraph in Details:
"For 2 by 2 cases, p-values are obtained directly using the (central or
non-central) hypergeometric distribution. Otherwise, computations are based
on a C version of the FORTRAN subroutine FEXACT which implements the network
developed by Mehta and Patel (1986) and improved by Clarkson, Fan and Joe
(1993). The FORTRAN code can be obtained from
http://www.netlib.org/toms/643. Note this fails (with an error message) when
the entries of the table are too large. (It transposes the table if
necessary so it has no more rows than columns. One constraint is that the
product of the row marginals be less than 2^31 - 1.)"
Thank you,
Jeff
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Greg Snow
Sent: Wednesday, May 07, 2008 9:55 AM
To: David Winsemius; r-help at stat.math.ethz.ch
Subject: Re: [R] categorical data analysis
The last example in ?fisher.test is not a 2x2 table, in fact it uses levels
with a natural ordering similar to the original question. Why would this
not be applicable to the situation?
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf
Of David Winsemius [dwinsemius at comcast.net]
Sent: Wednesday, May 07, 2008 7:34 AM
To: r-help at stat.math.ethz.ch
Subject: Re: [R] categorical data analysis
Simon Blomberg <s.blomberg1 at uq.edu.au> wrote in
news:1210130089.9048.11.camel at sib-sblomber01d.sib.uq.edu.au:
> But see these posts:
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/119079.html
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/119080.html
>
> Simon.
Interesting reading, but the OP specifically said he was not dealing with
2x2 tables, so neither fisher.test nor the suggested alternatives would
be applicable to his data situation.
--
David Winsemius
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Internal Virus Database is out-of-date.
11:27 AM
Internal Virus Database is out-of-date.
11:27 AM
More information about the R-help
mailing list