Skip to content

fisher exact for > 2x2 table

13 messages · viostorm, David Winsemius, Thomas Lumley +3 more

#
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.

Note: I can't use chi-squared because I have a couple of cells with 0 and <
5 observations.



--
View this message in context: http://r.789695.n4.nabble.com/fisher-exact-for-2x2-table-tp3481979p3481979.html
Sent from the R help mailing list archive at Nabble.com.
#
On Apr 28, 2011, at 3:45 PM, viostorm wrote:

            
Have you read the help page?

  
    
#
On Thu, 28 Apr 2011, viostorm wrote:

            
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.

Mike
#
On Fri, Apr 29, 2011 at 8:01 AM, Mike Miller <mbmiller+l at gmail.com> wrote:
In fact, with large tables, roundoff error becomes significant before
computational cost becomes prohibitive.

     -thomas
#
I have read the help page, or at least ?fisher.exact

I looked a bit on the Internet I guess it is applicable to > 2x2.  I had
spoken to a biostatistician here who is quite excellent and was adamant with
me I could not do > 2x2.

I found this:

http://mathworld.wolfram.com/FishersExactTest.html

Does anyone know specifically how R is calculating this?



--
View this message in context: http://r.789695.n4.nabble.com/fisher-exact-for-2x2-table-tp3481979p3482102.html
Sent from the R help mailing list archive at Nabble.com.
#
On Apr 28, 2011, at 4:23 PM, viostorm wrote:

            
Then it should have been clear that more than 2x2 tables can be used.
The answer to any question like that is ... look at the source. You  
will see extensive use of phyper() which is calculating that  
expression for various arguments.

?phyper
#
On Fri, 29 Apr 2011, Thomas Lumley wrote:

            
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
#
On Thu, 28 Apr 2011, viostorm wrote:

            
That page shows that the Fisher Exact test can be implemented on tables 
with any numbers of rows and columns (so long as there are at least two 
rows and two columns).  Your biostatistician just didn't happen to know 
about this, but s/he shouldn't have been adamant when s/he was wrong. 
Show your biostatistician the MathWorld page.

Mike
#
Thank you all very kindly for your help.

-Rob

--------------------------------
Robert Schutt III, MD, MCS 
Resident - Department of Internal Medicine
University of Virginia, Charlottesville, Virginia 


--
View this message in context: http://r.789695.n4.nabble.com/fisher-exact-for-2x2-table-tp3481979p3482351.html
Sent from the R help mailing list archive at Nabble.com.
#
After I shared comments form the forum yesterday with the biostatistician he
indicated this:

"Fisher's exact test is the non-parametric analog for the Chi-square 
test for 2x2 comparisons. A version (or extension) of the Fisher's Exact 
test, known as the Freeman-Halton test applies to comparisons for tables 
greater than 2x2. SAS can calculate both statistics using the following 
instructions.

  proc freq; tables a * b / fisher;"

Do people here still stand by position fisher exact test can be used for RxC
contingency tables ?  Sorry to both you all so much it is just important for
a paper I am writing and planning to submit soon. ( I have a 4x2 table but
does not meet expected frequencies requirements for chi-squared.)

I guess people here have suggested R implements, the following, which
unfortunately are unavailable at least easily at my library but  at least by
the titles indicates it is extending it to RxC 

Mehta CR, Patel NR. A network algorithm for performing Fisher's exact test
in r c contingency tables. Journal of the American Statistical Association
1983;78:427-34.
 
Mehta CR, Patel NR. Algorithm 643: FEXACT: A FORTRAN subroutine for Fisher's
exact test on unordered r x c contingency tables. ACM Transactions on
Mathematical Software 1986;12:154-61.

The only reason I ask again is he is exceptionally clear on this point.

Thanks again, 

-Rob
viostorm wrote:

        
viostorm wrote:
--
View this message in context: http://r.789695.n4.nabble.com/fisher-exact-for-2x2-table-tp3481979p3484009.html
Sent from the R help mailing list archive at Nabble.com.
#
Rob--

Your biostatistician has not disagreed with the rest of us about anything 
except for his preferred name for the test.  He wants to call it the 
Freeman-Halton test, some people call it the Fisher-Freeman-Halton test, 
but most people call it the Fisher Exact test -- all are the same test. 
When he was "adamant you could not do > 2x2", what he was being adamant 
about was the name you should use when referring to the test for tables 
larger than 2x2.  Why he was doing that, I don't know, but I think it is 
silly -- he confused you and the rest of us.

He goes on to tell you that to get the Freeman-Halton test in SAS, you use 
"tables a * b / fisher".  In other words, SAS calls the test "Fisher" 
instead of calling it Freeman-Halton.  R also calls it "Fisher" and not 
Freeman-Halton.  I'm like R and SAS and unlike your biostatistician, but 
to each his own.

You say that he is "exceptionally clear on this point," which may be true, 
but what is the point?  The point is that he prefers a different *name* 
for the test than the rest of us.  Everyone agrees on the math/stat.

Mike

--
Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota
On Fri, 29 Apr 2011, viostorm wrote:

            
#
On 29 April 2011 08:43, viostorm <rob.schutt at gmail.com> wrote:
SAS documentation says:

"Fisher's exact test was extended to general R?C tables by Freeman and
Halton (1951), and this test is *also* known as the Freeman-Halton
test."

Emphasis mine.

Jeremy