# Re: [R] fisher exact for > 2x2 table

Date: Fri, 29 Apr 2011 14:51:23 -0600

Rob: Fisher's exact test is conceptually possible for any r x c contingency table problem and uses the observed multinomial table probability as the test statistic. Other tests for r x c contingency tables use a different test statistic (Chi-squared, likelihood ratio, Zelterman's). It is possible that the probabilities for any of these procedures may differ slightly for the same table configuration even if the probabilities for each test are calculated by enumerating all possible permutations (hypergeometric) under the null hypothesis. See Mielke and Berry 2007 (Permutation Methods: A distance function approach) Chps 6 and7. Mielke has provided efficient Fortran algorithms for enumerating the exact probabilities for 2x2, 3x2, 4x2, 5x2, 6x2 ,3x3,and even 2x2x2 tables for Fisher's exact and Chi-square statistics. I don't remember whether Cyrus Meta's algorithms for Fisher's exact can do more. But the important point to keep in mind is that it is possible to use different statistics for evaluating the same null hypothesis for r x c tables (Fisher's exact uses one form, Chi-square uses another, etc.) and the probabilities can be computed by exact enumeration of all permutations (what people expect Fisher's exact to do but also possible for Chi-square statistic) or by some approximation (asymptotic distribution, Monte Carlo resampling). The complete enumeration of test statistics under the null becomes computationally intractable for large dimension r x c problems whether using the observed table probability (like Fisher's exact) as a test statistic or other like Chi-square statistic.

So in short, yes you can use Fisher's exact on your 4 x 2 problem, and the result might differ from using a Chi-square statistic even if you compute the P-value for the Chi-square test by complete enumeration. Note that the minimum expected cell size for the Chi-square test is related to whether the Chi-square distributional approximation (an asymptotic argument) for evaluating the Chi-square statistic will be reasonable and is irrelevant if you calculate your probabilities by exact enumeration of all permutations.

Brian

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO 80526-8818

tel: 970 226-9326

From:
viostorm <rob.schutt_at_gmail.com>
To:
r-help_at_r-project.org
Date:
04/29/2011 01:23 PM
Subject:
Re: [R] fisher exact for > 2x2 table
Sent by:
r-help-bounces_at_r-project.org

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:
>
> Thank you all very kindly for your help.
>
> -Rob
>
> --------------------------------
> Robert Schutt III, MD, MCS
> Resident - Department of Internal Medicine
> University of Virginia, Charlottesville, Virginia
>

viostorm wrote:
>
> 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-tp3481979p3484009.html

Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help