Re: [R] categorical data analysis - fisher.exact for 2x2 and greater

From: Dr. Jeff Miller <jeffmiller_at_alphapoint05.net>
Date: Wed, 07 May 2008 11:56:07 -0400

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

______________________________________________
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.
Received on Wed 07 May 2008 - 16:49:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 07 May 2008 - 19:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive