# Fisher's exact test

I am an archaeologist (PhD candidate) that has recently learned how to perform chi squared tests. However, I am told that for the table below, I would need a Fisher's exact test since some of the bins have <5 in them.

I know that this test is usually for 2x2 tables but that it's possible to use it for larger tables too and I have found a number of sites that allow you to enter the data and give you a P value for 2x4 tables such as mine.

However, I know that in citing the results of a chi-squared test, I must quote the test statistic and the df and presume that I would have to do so for this test also.

I know how to work out the df for chi-squared tests (Row-1)*(Columns-1) but wondered if it was the same foe the Fisher's exact test.

As for the test statistic, I would have no idea where to start. Any help would be much appreciated.

Apologies if this is an old question. I think another person may have asked about this already, although the terminology used in both the question and the answer made it hard to be certain!

Grade 1:    0       2    |   2
Grade 2:    5      58    |  63
Grade 3:    4       3    |   7
Grade 4:    4       3    |   7
--------------+-----
TOTAL:     13      66    |  79

• Fisher’s test is hard to generalize to higher dimension tables. You may use the $\chi^2$ test with the adjustement suggested by @whuber in his answer to this question. Note that he gives a reference to the litterature to help you justify your choice. – Elvis Dec 4 '13 at 9:50
• @Elvis Thank you so much for your reply and for fixing my attempt at displaying my table! As a first time user of this site I really appreciate the help of people who must think my questions very basic. Not all my expected frequencies exceed 1 but it seems the Fisher-Irwin test might be something I can use instead. Many thanks again. – Denise Dec 4 '13 at 10:35
• "since some of the bins have <5 in them" -- this is too strong a restriction, as numerous papers have concluded, however, some of the expected values are quite small, so perhaps the chi-square distribution won't be a sufficiently good approximation.  "I would need a Fisher's exact test" -- that's far from the only alternative; for example, one can simulate from the (discrete) distribution of the chi-square test statistic and so don't have to rely on the accuracy of the chi-square distribution. – Glen_b Dec 4 '13 at 10:38
• @Elvis I think you mean Frank Harrell's answer there (whuber edited it) – Glen_b Dec 4 '13 at 10:44
• I had asked a similar question. You still should be able to use a $\chi^2$ test with a (N-1) correction, subject to certain conditions. Have a look at this link – Zhubarb Dec 4 '13 at 11:51

The massive 58 amid much lower frequencies signals that any test is just quantifying a major failure of independence. I did this in Stata. The command ret li (short for return list) obliges Stata to show results as exactly as it knows them, but both tests yield P-values that are 0.000 to 3 d.p. It is right to be a little cautious about low expected values (for row 1 here in particular) but the test results are overwhelming.

. tabi 0  2 \ 5 58 \ 4 3 \ 4 3

|          col
row |         1          2 |     Total
-----------+----------------------+----------
1 |         0          2 |         2
2 |         5         58 |        63
3 |         4          3 |         7
4 |         4          3 |         7
-----------+----------------------+----------
Total |        13         66 |        79

Pearson chi2(3) =  20.5779   Pr = 0.000

. ret li

scalars:
r(p) =  .0001288081813192
r(chi2) =  20.57794057794058
r(c) =  2
r(r) =  4
r(N) =  79

. tabi 0  2 \ 5 58 \ 4 3 \ 4 3 , exact

Enumerating sample-space combinations:
stage 4:  enumerations = 1
stage 3:  enumerations = 3
stage 2:  enumerations = 17
stage 1:  enumerations = 0

|          col
row |         1          2 |     Total
-----------+----------------------+----------
1 |         0          2 |         2
2 |         5         58 |        63
3 |         4          3 |         7
4 |         4          3 |         7
-----------+----------------------+----------
Total |        13         66 |        79

Fisher's exact =                 0.000

. ret li

scalars:
r(p_exact) =  .0003124258226793
r(c) =  2
r(r) =  4
r(N) =  79

• Many thanks for this. Very much appreciated. If I could ask one last question it would be whether it is the norm to quote a df and test statistic figure and if, considering your answer above, they might respectively be 3 and 20.57794057794058 – Denise Dec 4 '13 at 14:14
• As you ask, quoting a chi-square statistic to 14 d.p. would at best be considered a rather strange joke and at worst as strong evidence of not thinking! I wouldn't give more digits than 20.578. That's still more than anyone needs, but more conventional. The number of degrees of freedom for this test is 3, as you said earlier, as (#rows - 1)(#cols - 1). Note that chi-square tests appear in all kinds of statistical problems; this is just one of the two kinds met first in many elementary courses. – Nick Cox Dec 4 '13 at 14:37
• Now that I have learnt how to calculate the Fisher's Exact Test myself in SPSS, I notice that the 20.578 figure accompanies the output for the Pearson Chi-Square, whereas 16.742 accompanies the Fisher's Exact. Shouldn't it be the case that, in quoting the test statistic, the former is quoted for the Pearson (albeit recognising that 4 cells have an expected count of less than 5) and the latter for the Fisher? – Denise Feb 10 '14 at 10:04
• Sorry, but (1) I don't use SPSS (2) I don't understand your new question. Best to ask a new question explaining directly what puzzles you. – Nick Cox Feb 10 '14 at 10:11