> TVScU@ 9?bjbj .q6
<+<+<+8t+4+J2,v----g.g.g.PJRJRJRJRJRJRJ$LRUNvJ/g.g.//vJ--J555/--CZ5/PJ5(56V>@f?-,`ȗTb<+#0>?$J0J>xN1xNf?Nf?lg.{.5..pg.g.g.vJvJ(<+5^<+The analysis of categorical data: Fishers Exact test
Jenny V Freeman, Michael J Campbell
Introduction
In the previous tutorial we have outlined some simple methods for analysing binary data, including the comparison of two proportions using the Normal approximation to the binomial and the Chi-squared test( ADDIN REFMGR.CITE Freeman2007320The analysis of categorical dataJournal320The analysis of categorical dataFreeman,J.V.Julious,S.A.2007scopeStatisticsNot in File1821Scope161Scope1(1)). However, these methods are only approximations, although the approximations are good when the sample size is large. When the sample size is small we can evaluate all possible combinations of the data and compute what are known as exact P-values.
Fishers Exact test
When one of the expected values (note: not the observed values) in a 2x2 table is less than 5, and especially when it is less than 1, then Yates correction can be improved upon. In this case Fishers Exact test, proposed in the mid-1930s almost simultaneously by Fisher, Irwin and Yates ADDIN REFMGR.CITE Armitage2002319Statistical Methods in Medical ResearchBook, Whole319Statistical Methods in Medical ResearchArmitage,P.Berry,P.J.Matthews,J.N.S.2002StatisticsNot in File1344OxfordBlackwells2(2), can be applied. The null hypothesis for the test is that there is no association between the rows and columns of the 2x2 table, such that the probability of a subject being in a particular row is not influenced by being in a particular column. If the columns represented the study group and the rows represented the outcome, then the null hypothesis could be interpreted as the probability of having a particular outcome is not influenced by the study group, and the test evaluates whether the two study groups differ in the proportions with each outcome.
An important assumption for all of the methods outlined, including Fishers exact test, is that the binary data are independent. If the proportions are correlated, then more advanced techniques should be applied. For example in the leg ulcer example of the previous tutorial ADDIN REFMGR.CITE Freeman2007320The analysis of categorical dataJournal320The analysis of categorical dataFreeman,J.V.Julious,S.A.2007scopeStatisticsNot in File1821Scope161Scope1(1), if there were more than one leg ulcer per patient, we could not treat the outcomes as independent.
The test is based upon calculating directly the probability of obtaining the results that we have obtained (or results more extreme) if the null hypothesis is actually true, using all possible 2x2 tables that could have been observed, for the same row and column totals as the observed data. These row and column totals are also known as marginal totals. What we are trying to establish is how extreme our particular table (combination of cell frequencies) is in relation all the possible ones that could have occurred given the marginal totals.
This is best explained by a simple worked example. The data below come from an RCT comparing intra-muscular magnesium injections with placebo for the treatment of chronic fatigue syndrome ADDIN REFMGR.CITE Cox1991318Red blood cell magnesium and chronic fatigue syndromeJournal318Red blood cell magnesium and chronic fatigue syndromeCox,I.MCampbell,M.J.Dowson,D.1991riskStatisticsNot in File757760Lancet337Lancet1(3). Of the 15 patients who had the intra-muscular magnesium injections 12 felt better (80%), whereas, of the 17 on placebo, only 3 felt better (18%).
Table 1: Results of the study to examine whether intramuscular magnesium is better than placebo for the treatment of chronic fatigue syndrome
MagnesiumPlaceboTotal Felt better
Did not feel better12
33
1415
17Total151732
There are 16 different ways of rearranging the cell frequencies for the above table, whilst keeping the marginal totals the same, as illustrated below in figure 1. The result that corresponds to our observed cell frequencies is (xiii):
Figure 1: Illustration of all the different ways of rearranging cell frequencies in table 1, but with the marginal totals remaining the same
(i) 0 15
15 2(ii) 1 14
14 3(iii) 2 13
13 4(iv) 3 12
12 5(v) 4 11
11 6(vi) 5 10
10 7(vii) 6 9
9 8(viii) 7 8
8 9(ix) 8 7
7 10(x) 9 6
6 11(xi) 10 5
5 12(xii) 11 4
4 13(xiii) 12 3
3 14(xiv) 13 2
2 15(xv) 14 1
1 16(xvi) 15 0
0 17
The general form of table 1 is given in table 2 and under the null hypothesis of no association Fisher showed that the probability of obtaining the frequencies, a, b, c and d in table 2 is
EMBED Equation.3 (1)
where x! is the product of all the integers between 1 and x, e.g. 5!=1x2x3x4x5=120 (note that for the purpose of this calculation, we define 0! as 1). Thus for each of the results (i) to (xvi) the exact probability of obtaining that result can be calculated (table 3). For example, the probability of obtaining table (i) in figure 1 is EMBED Equation.3 =0.0000002
Table2: General form of table 1
Column 1Column 2TotalRow 1
Row 2a
cb
da+b
c+dTotala+cb+da+b+c+d
Table 3: Probabilities associated with each of the frequency tables above, calculated using formula 1
TableabcdP-value i
ii
iii
iv
v
vi
vii
viii
ix
x
xi
xii
xiii
xiv
xv
xvi0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1515
14
13
12
11
10
9
8
7
6
5
4
3
2
1
015
14
13
12
11
10
9
8
7
6
5
4
3
2
1
02
3
4
5
6
7
8
9
10
11
12
13
14
15
16
170.0000002
0.0000180
0.0004417
0.0049769
0.0298613
0.1032349
0.2150728
0.2765221
0.2212177
0.1094916
0.0328475
0.0057426
0.0005469
0.0000252
0.0000005
0.0000000
From table 3 we can see that the probability of obtaining the observed frequencies for our data is that which corresponds with (xiii), which gives p=0.0005469 and the probability of obtaining our results or results more extreme (a difference that is at least as large) is the sum of the probabilities for (xiii) to (xvi) = 0.000573. This gives the one-sided P-value or obtaining our results or results more extreme, and in order to obtain the two-sided p-value there are several approaches. The first is to simply double this value, which gives p=0.0001146. A second approach is to add together all the probabilities that are the same size or smaller than the one for our particular result, in this case, all probabilities that are less than or equal to 0.0005469, which are tables (i), (ii), (iii), (xiii), (xiv), (xv) and (xvi). This gives a two-sided value of p=0.001033. Generally the difference is not great, though the first approach will always give a value greater than the second. A third approach, which is recommended by Swinscow and Campbell ADDIN REFMGR.CITE Swinscow2002209Statistics at square oneBook, Whole209Statistics at square oneSwinscow,T.D.VCampbell,M.J.2002displaying dataStatisticsNot in File10LondonBMJ Books2(4) is a compromise and is known as the mid-p method. All the values more extreme than the observed p-value are added up and these are added to one half of the observed value. This gives p=0.000759.
The criticism of the first two methods is that they are too conservative, i.e. is the null hypothesis was true, over repeated studies they would reject the null hypothesis less often than 5%. They are conditional on both sets of marginal totals being fixed, i.e. exactly 15 people being treated with magnesium and 15 feeling better. However, if the study were repeated, even with 15 and 17 in the magnesium and placebo groups respectively, we would not necessarily expect exactly 15 to feel better. The mid-p value method is less conservative, and gives approximately the correct rate of type I errors (false positives).
In either case, for our example, the P-value is less than 0.05, the nominal level for statistical significance and we can conclude that there is evidence of a statistically significant difference in the proportions feeling better between the two treatment groups. However, in common with other non-parametric tests, Fishers exact test is simply a hypothesis test. It will merely tell you whether a difference is likely, given the null hypothesis (of no difference). It gives you no information about the likely size of the difference, and so whilst we can conclude that there is a significant difference between the two treatments with respect to feeling better or not, we can draw no conclusions about the possible size of the difference.
Example data from last week
Table 1 shows the data from the previous tutorial. It is from a randomised controlled trial of community leg ulcer clinics ADDIN REFMGR.CITE Morrell1998231Cost effectiveness of community leg ulcer clinic: randomised controlled trialJournal231Cost effectiveness of community leg ulcer clinic: randomised controlled trialMorrell,C.J.Walters,S.J.Dixon,S.Collins,K.Brereton,L.M.L.Peters,J.Brooker,C.G.D.1998scopeStatisticsNot in File14871491British Medical Journal316British Medical Journal1(5), comparing the cost-effectiveness of community leg ulcer clinics with standard nursing care. The columns represent the two treatment groups, specialist leg ulcer clinic (clinic) and standard care (home), and the rows represent the outcome variable, in this case whether the leg ulcer has healed or not.
Table 1: 2 x 2 contingency table of Treatment (clinic/home) by Outcome (ulcer healed / not healed) for the Leg ulcer study
TreatmentClinicHomeTotalOutcome:
Healed
Not healed
22 (18%)
98 (82%)
17 (15%)
96 (85%)
39
194Total120 (100%)113 (100%)233
For this example the two-sided p-value from Fishers exact test is 0.599 two-sided and in this case we would not reject the null and would conclude that there is insufficient evidence to
Summary
This tutorial has described in detail Fishers exact test, for analysing simple 2x2 contingency tables when the assumptions for the chi-squared test are not met. It is tedious to do by hand, but nowadays is easily computed by most statistical packages.
ADDIN REFMGR.REFLIST Reference List
(1) Freeman JV, Julious SA. The analysis of categorical data. Scope 2007;16(1):18-21.
(2) Armitage P, Berry PJ, Matthews JNS. Statistical Methods in Medical Research. 4 ed. Oxford: Blackwells; 2002.
(3) Cox IM, Campbell MJ, Dowson D. Red blood cell magnesium and chronic fatigue syndrome. Lancet 1991;337:757-60.
(4) Swinscow TDV, Campbell MJ. Statistics at square one. 10 ed. London: BMJ Books; 2002.
(5) Morrell CJ, Walters SJ, Dixon S, Collins K, Brereton LML, Peters J, et al. Cost effectiveness of community leg ulcer clinic: randomised controlled trial. British Medical Journal 1998;316:1487-91.
When organising data such as this is it good practice to arrange the table with the grouping variable forming the columns and the outcome variable forming the rows.
Page PAGE 1
67HZ\]j7 8 9
"#%,12=>}):+-E7?@{'<@dfҾںںڮڮڮh
1hjhUh[hyhghSjhSUh*phM h>hjh>UhOh45\ hg5h4 h45A67\]jk
,-z{$$Ifa$gdgdagdq>?8?finsYZlmpqI\ltuvm n o p q r ŻŔh;h;CJaJh;hh;5\hZh>ha5\jh>h>0J5Uh>h5\hh5\hha5\h5\hjhaUhahh[h
1hq3^OOAAAA$x$Ifa$gd
@x$Ifgdkd$$Ifl\H$Z Z Z Z
t0644
laPEx$Ifgdkd$$Ifl\H$Z Z Z Z
t0644
la$x$Ifa$gdn o ^YTYTOgd;gdgdakd$$Ifl\H$Z Z Z Z
t0644
lao s y
h8BBx$Ifgd$x$Ifa$gdZ
h8BBx$Ifgd;$
h8BBx$Ifa$gdZ 7#$
h8BBx$Ifa$gdZkd$$Ifl0ִLTx<#h
t6 44
la $x$Ifa$gd$x$Ifa$gdZ
h8BBx$Ifgd; 7#$
h8BBx$Ifa$gdZkd$$Ifl[ִLTx<#h
t6 44
la !!
!!
!!!!!!! !!!#!$!%!'!(!)!+!,!.!/!1!2!4!5!6!7!9!:!=!>!@!B!C!D!F!G!H!J!K!L!T!V!Z![!h!i!l!m!o!q!r!s!u!v!w!y!z!{!}!~!!!!!!!!!!!!!h;hhZh;hZCJaJ\
h8BBx$Ifgd;$x$Ifa$gdZ
h8BBx$Ifgd !!9%$
h8BBx$Ifa$gdZkd.$$IflִLTx<#h
t6 44
la!!!!!!!!$x$Ifa$gd$x$Ifa$gdZ
h8BBx$Ifgd;! !!9%$
h8BBx$Ifa$gdZkd$$IflִLTx<#h
t6 44
la!!!!"!(!-!3!9!?!E!K!
h8BBx$Ifgd
h8BBx$IfgdZ$x$Ifa$gdZ
h8BBx$Ifgd;K!L!M!9%$
h8BBx$Ifa$gdZkd$$IflִLTx<#h
t6 44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Ifl\H$Z Z Z Z
t0644
la$$Ifa$gdg999999999999$x$Ifa$gdgx$Ifgdg
Ax$Ifgdg99::::^SEEE$x$Ifa$gdgx$Ifgdgkd$$Ifl\H$Z Z Z Z
t0644
la:::::::;;^YTYRRMRgd-gdMjgdgkd$$Ifl\H$Z Z Z Z
t0644
la;<<`<<G==l>m>p>q>?????? ?"?#?%?&?gd>gd>
gdg
h^`gd
h^`gd$a$gd!?#?$?&?+?,?2?3?4?5?7?8?9?h4h0JmHnHu
h>0Jjh>0JUh>jhe--Uhe--&?6?7?8?9?
gdg$a$gd>,1h. A!"#$%$$If!vh5Z 5Z 5Z 5Z #vZ :Vl
t065Z //////$$If!vh5Z 5Z 5Z 5Z #vZ :Vl
t065Z //
//$$If!vh5Z 5Z 5Z 5Z #vZ :Vl
t065Z /////$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl0
t6555h55555///////////$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl[
t6555h55555////{$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl
t6555h55555///////////$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl
t6555h55555////{$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl
t6555h55555///////////$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl
t6555h55555////{$$If!vh555h55555#v#v#vh#v#v#v#v#v:Vl
t6555h55555///////////Dd
b
c$A??3"`?2(W90Q^B
KN `!W90Q^B
K6@@xڕK/QϹ3}:`Z">A%H$"zUIز+Xxl,l%#xnuaa;9{NE0_
ejYRQ6yj<#Q{8P`s>)_\Ը˱`8SXN6_ߙrGUF,%
8blKeg`Wr٭H2prR+VceU}DSuk)'-ۦh?.z.u/k~mQ}Ҡt7:o5A?NeJ1˜53>ԟPłh`PfB4h{P_?`Ors53\J=935Gq5*Jt})wAvq$Fդ<M"NE&J[lb ؓ03I7jDd
l#(b
c$A??3"`?2\lMײZN `!\lMײZvxVxcdd``f2
ĜL0##0KQ*
W
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJLMNOPQR[UXYZ`a\]^_befghijklmnopqrstuvwxyz{|}~Root Entry F0LTbWData
K\WordDocument.ObjectPoolp~Tb0LTb_1234618262 Fp~Tbp~TbOle
CompObjfObjInfo
FMicrosoft Equation 3.0DS EquationEquation.39q=ºxY
(a+b)!(c+d)!(a+c)!(b+d)!(a+b+c+d)!a!b!c!d!Equation Native _1234688614Fp~Tbp~TbOle
CompObj
f
FMicrosoft Equation 3.0DS EquationEquation.39qvP@
15!17!15!17!32!0!15!15!2!Oh+'0ObjInfo
Equation Native 1TabledOSummaryInformation( A?dv@=P5<%!@5@_L ĺE,a L
*'031d++&1X +|-IkˈUOaY@54Xp>3n&Ty0ƈ*ol2GOboKBF?\F1&TgQ3@sAce(p321)W20Csg!h<2@Y$$If !vh585T5T5#v8#vT#v:Vl
t06585T5//////a $$If !vh585T5T5#v8#vT#v:Vl
t06585T5//
//a $$If !vh585T5T5#v8#vT#v:Vl
t06585T5/////a $$If !vh5585858585T#v#v8#vT:Vl
t65585T////////a $$If !vh5585858585T#v#v8#vT:Vl
t65585T////////a $$If!vh5Z 55Z #vZ #v#vZ :Vl
t065Z 55Z /$$If!vh5Z 5Z 5Z 5Z #vZ :Vl
t065Z //////$$If!vh5Z 5Z 5Z 5Z #vZ :Vl
t065Z //
//$$If!vh5Z 5Z 5Z 5Z #vZ :Vl
t065Z ///// 4@
\ht
!The analysis of categorical dataicrhe Authorised UseruthuthNormal.dotUAuthorised User10hMicrosoft Word 10.0@C@D8@]@NSb Q.՜.+,0hDocumentSummaryInformation8LCompObjjp
Authorised OrganizationbV6{
!The analysis of categorical dataTitle
FMicrosoft Word Document
MSWordDocWord.Document.89q@@@NormalCJ_HaJmH sH tH :@: Heading 1$@&5\DA@DDefault Paragraph FontVi@VTable Normal :V44
la(k(No List4@4Header
9r >@>
Footnote TextCJaJ@&@@Footnote ReferenceH*4 @"4Footer
9r .)@1.>Page Number979767\]jk ,-z{nosy "(-39?EKLMNOPQRSTU\bhntz]^{|#)*068:<>BFGMQU]^_`a$&(*,.02468;>ADGJMPSVY\^`bdfhjlnpsvy|",6@JT^_`a%%0(1(++4+5+111111111111111111111111122222222223344`44G55l6m6p6q677777"7%767:700000000000000x000000 0 0 0 0 00 00 00 00 0 0 0 0 0 0 000000 00 0 00 0 00 0 00 0 0 0 0 0 0 0 0 0 0 0 00 0 00 0 00 0 00 0 0 0 0 0 0 0 0 0 0 0 00 0 00 0 00 0 00 0 0 0 0 0 0 0 0 0 0 0 00 0 00 0 00 0 00 0 0000000000 0 0 0 0 00 00 00 00 0 0 0 0 0 0 00000 0 0 0 0 0 0 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0 00x0x0x0x0x0x0x0x0x0x0x0x0 0 0 0 0 0 0 0 0 000 000 000 000 0 0 0 0 0 0 0000x0x0x0x0x0x0x0x0x0x0x0x0x00@0@008G@0@0@0@0@00(H f !u(!?9? #+5AHo !!!K!M!T!\!!^")$>$]$$$A%%%^&3999:;&?9?!$%&'()*,-./012346789:;<=>?@BCDEFGI8?"8
=?Ylp_su"$$+//33m697QQQQ::QQQ !8@0(
B
S ?(;":7:7V*urn:schemas-microsoft-com:office:smarttagsplacehttp://www.5iantlavalamp.com/pq12>ABEMPQTU\q!r!j"r"4!4f4n44444M5U5q67777777 7"7#7%7&777:7+0|&4G4R4U444:5B5H5g5h55^6g6q6667777777 7"7#7%7&777:7333333333333]i ot KU;<` -.12345678:;@ACDFGLMOPRSUVXY[\]^_`cdghklmnop
+,56?@IJST`%%+5+1111111111111
222H4a4B6p6q67777777 7"7#7%7&7+777:7q67777777 7"7#7%7&777:7Authorised Userk"-~BA:?9mEdhh
^`o(hH.h^`OJQJ^Jo(hHohpp^p`OJQJo(hHh@@^@`OJQJo(hHh^`OJQJ^Jo(hHoh^`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohPP^P`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohpp^p`OJQJo(hHh@@^@`OJQJo(hHh^`OJQJ^Jo(hHoh^`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohPP^P`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohpp^p`OJQJo(hHh@@^@`OJQJo(hHh^`OJQJ^Jo(hHoh^`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohPP^P`OJQJo(hHBAk"-0?9mE >M d"e--
1$=Z[MjS-q*p;gyaO4os (-9?KLMNOPQRSTU\hnz#)*6:>FGMQU]^$Jp^_11111111111111122222:7REFMGR.InstantFormatdߴ
REFMGR.LayoutREFMGR.Libraries~s<InstantFormat><Enabled>1</Enabled><ScanUnformatted>1</ScanUnformatted><ScanChanges>1</ScanChanges></InstantFormat>1<Layout><StartingRefnum>Vancouver</StartingRefnum><FontName>Times New Roman</FontName><FontSize>12</FontSize><ReflistTitle>Reference List</ReflistTitle><SpaceAfter>1</SpaceAfter><ReflistOrder>0</ReflistOrder><CitationOrder>0</CitationOrder><NumberReferences>1</NumberReferences><FirstLineIndent>0</FirstLineIndent><HangingIndent>0</HangingIndent><LineSpacing>0</LineSpacing><ShowReprint>1</ShowReprint><ShowNotes>0</ShowNotes><ShowKeywords>0</ShowKeywords><ShortFormFields>0</ShortFormFields><ShowRecordID>0</ShowRecordID><ShowAbstract>0</ShowAbstract></Layout>I<Databases><Libraries><item>all_references</item></Libraries></Databases>@33$3397@UnknownGz Times New Roman5Symbol3&z Arial?5 z Courier New;Wingdings"1hxƅKL|&
Q.b Q.b!4dV6V6;2qHX?$= The analysis of categorical dataAuthorised UserAuthorised User