[R] fisher exact for > 2x2 table

Mike Miller mbmiller+l at gmail.com
Thu Apr 28 23:26:51 CEST 2011


On Fri, 29 Apr 2011, Thomas Lumley wrote:

> On Fri, Apr 29, 2011 at 8:01 AM, Mike Miller <mbmiller+l at gmail.com> wrote:
>
>> On Thu, 28 Apr 2011, viostorm wrote:
>>
>>> I'm using fisher.exact on a 4x2 table and it seems to work.
>>>
>>> Does anyone know exactly what is going on?  I thought fisher.exact is 
>>> only for 2x2 tables.
>>
>>
>> You were wrong.  I'm sure there's nothing wrong with the program.  You 
>> will find that with bigger tables and larger sample sizes the 
>> computational cost becomes quite enormous.
>
> In fact, with large tables, roundoff error becomes significant before 
> computational cost becomes prohibitive.


To avoid both of these problems one might use Monte Carlo resampling under 
the null, maybe 10,000 times or more.  I think independence_test() in the 
coin package will do this:

http://cran.r-project.org/web/packages/coin/

To estimate very small p-values properly, one must resample many more 
times.

Mike


More information about the R-help mailing list