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 chisquared because I have a couple of cells with 0 and < 5 observations. 
On Apr 28, 2011, at 3:45 PM, 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. Have you read the help page? >  David Winsemius, MD West Hartford, CT ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by viostorm
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. Mike ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
On Fri, Apr 29, 2011 at 8:01 AM, Mike Miller <[hidden email]> 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. thomas  Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by David Winsemius
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? 
On Apr 28, 2011, at 4:23 PM, viostorm wrote: > > I have read the help page, or at least ?fisher.exact Then it should have been clear that more than 2x2 tables can be used. > > 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? 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  David Winsemius, MD West Hartford, CT ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by Thomas Lumley2
On Fri, 29 Apr 2011, Thomas Lumley wrote:
> On Fri, Apr 29, 2011 at 8:01 AM, Mike Miller <[hidden email]> 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.rproject.org/web/packages/coin/ To estimate very small pvalues properly, one must resample many more times. Mike ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by viostorm
On Thu, 28 Apr 2011, viostorm wrote:
> 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 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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by viostorm
Thank you all very kindly for your help. Rob  Robert Schutt III, MD, MCS Resident  Department of Internal Medicine University of Virginia, Charlottesville, Virginia 
This post was updated on .
After I shared comments form the forum yesterday with the biostatistician he indicated this:
"Fisher's exact test is the nonparametric analog for the Chisquare test for 2x2 comparisons. A version (or extension) of the Fisher's Exact test, known as the FreemanHalton 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 chisquared.) 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:42734. 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:15461. The only reason I ask again is he is exceptionally clear on this point. Thanks again, Rob

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 (Chisquared, 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 Chisquare 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, Chisquare 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 Chisquare 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 Chisquare 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 Chisquare statistic even if you compute the Pvalue for the Chisquare test by complete enumeration. Note that the minimum expected cell size for the Chisquare test is related to whether the Chisquare distributional approximation (an asymptotic argument) for evaluating the Chisquare statistic will be reasonable and is irrelevant if you calculate your probabilities by exact enumeration of all permutations. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 805268818 email: [hidden email] tel: 970 2269326 From: viostorm <[hidden email]> To: [hidden email] Date: 04/29/2011 01:23 PM Subject: Re: [R] fisher exact for > 2x2 table Sent by: [hidden email] After I shared comments form the forum yesterday with the biostatistician he indicated this: "Fisher's exact test is the nonparametric analog for the Chisquare test for 2x2 comparisons. A version (or extension) of the Fisher's Exact test, known as the FreemanHalton 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 chisquared.) 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:42734. 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:15461. 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/fisherexactfor2x2tabletp3481979p3484009.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by viostorm
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 FreemanHalton test, some people call it the FisherFreemanHalton 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 FreemanHalton test in SAS, you use "tables a * b / fisher". In other words, SAS calls the test "Fisher" instead of calling it FreemanHalton. R also calls it "Fisher" and not FreemanHalton. 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: > > After I shared comments form the forum yesterday with the biostatistician he > indicated this: > > "Fisher's exact test is the nonparametric analog for the Chisquare > test for 2x2 comparisons. A version (or extension) of the Fisher's Exact > test, known as the FreemanHalton 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 chisquared.) > > 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:42734. > > 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:15461. > > The only reason I ask again is he is exceptionally clear on this point. > > Thanks again, > > Rob ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
In reply to this post by viostorm
On 29 April 2011 08:43, viostorm <[hidden email]> wrote:
> > After I shared comments form the forum yesterday with the biostatistician he > indicated this: > > "Fisher's exact test is the nonparametric analog for the Chisquare > test for 2x2 comparisons. A version (or extension) of the Fisher's Exact > test, known as the FreemanHalton test applies to comparisons for tables > greater than 2x2. SAS can calculate both statistics using the following > instructions. > > proc freq; tables a * b / fisher;" > 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 FreemanHalton test." Emphasis mine. Jeremy  Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/rhelp PLEASE do read the posting guide http://www.Rproject.org/postingguide.html and provide commented, minimal, selfcontained, reproducible code. 
Powered by Nabble  Edit this page 