You are on page 1of 9

CochranMantelHaenszel test for repeated tests of independence

When to use it
You use the CochranMantelHaenszel test (which is sometimes called the MantelHaenszel test) for repeated tests of independence. There are three nominal variables; ou want to !now whether two of the variables are independent of each other" and the third variable identifies the repeats. The most common situation is that ou have multiple #$# tables of independence" so that%s what &%ll tal! about here. There are versions of the CochranMantelHaenszel test for an number of rows and columns in the individual tests of independence" but & won%t cover them.

' pon wearin( pin! le(warmers.

)or e*ample" let%s sa ou%ve found several hundred pin! !nit pol ester le(warmers that have been hidden in a warehouse since the went out of st le in +,-.. You decide to see whether the reduce the pain of an!le osteoarthritis b !eepin( the an!les warm. &n the winter" ou recruit /0 volunteers with an!le arthritis" randoml assi(n #1 to wear the le(warmers under their clothes at all times while the other +0 don%t wear the le(warmers" then after a month ou as! them whether their an!les are pain2free or not. 3ith 4ust the one set of people" ou%d have two nominal variables (le(warmers vs. control" pain2free vs. pain)" each with two values" so ou%d anal ze the data with )isher%s e*act test.

However" let%s sa ou repeat the e*periment in the sprin(" with 51 new volunteers. Then in the summer ou repeat the e*periment a(ain" with #- new volunteers. You could 4ust add all the data to(ether and do )isher%s e*act test on the ++. total people" but it would be better to !eep each of the three e*periments separate. Ma be the first time ou did the e*periment there was an overall hi(her level of an!le pain than the second time" because of the different time of ear or the different set of volunteers. You want to see whether there%s an overall effect of le(warmers on an!le pain" but ou want to control for possibilit of different levels of an!le pain at the different times of ear.

Null hypothesis
The null h pothesis is that the two nominal variables that are tested within each repetition are independent of each other; havin( one value of one variable does not mean that it%s more li!el that ou%ll have one value of the second variable. )or our ima(inar le(warmers e*periment" the null h pothesis would be that the proportion of people feelin( pain was the same for le(warmer2wearers and non2 le(warmer wearers" after controllin( for the time of ear. The alternative h pothesis is that the proportion of people feelin( pain was different for le(warmer and non2le(warmer wearers.
Technicall " the null h pothesis of the CochranMantelHaenszel test is that the odds ratios within each repetition are e6ual to +. The odds ratio is e6ual to + when the proportions are the same" and the odds ratio is different from + when the proportions are different from each other. & thin! proportions are easier to (rasp than odds ratios" so &%ll put ever thin( in terms of proportions.

How it works
&f the four numbers in a #$# test of independence are labelled li!e this7

a c

b d

and (a8b8c8d)9n" the e6uation for the CochranMantelHaenszel test statistic can be written li!e this7

2 MH

= {|[a(a+b)(a+c)/n]|0.5}

(a+b)(a+c)(b+d)(c+d)/(n n )
3 2

The numerator contains the absolute value of the difference between the observed value in one cell (a) and the e*pected value under the null h pothesis" (a8b)(a8c):n" so the numerator is the s6uared sum of deviations between the observed and e*pected values. &t doesn%t matter how ou arran(e the #$# tables" an of the four values can be used as a. The 1.5 is subtracted as a continuit correction. The denominator contains an estimate of the variance of the s6uared differences. The test statistic" ; " (ets bi((er as the differences between the observed and e*pected values (et lar(er" or as the variance (ets smaller (primaril due to the sample size (ettin( bi((er). &t is chi2 s6uare distributed with one de(ree of freedom. <ifferent sources present the formula for the CochranMantel Haenszel test in different forms" but the are all al(ebraicall e6uivalent. The formula &%ve shown here includes the continuit correction (subtractin( 1.5 in the numerator); sometimes the CochranMantelHaenszel test is done without the continuit correction" so ou should be sure to specif whether ou used it when reportin( our results. =ome statisticians recommend that ou test the homo(eneit of the odds ratios in the different repeats" and if different repeats show si(nificantl different odds ratios" ou shouldn%t do the Cochran MantelHaenszel test. &n our arthritis2le(warmers e*ample" the would sa that if le(warmers have a si(nificantl different effect on pain in the different seasons" ou should anal ze each e*periment separatel " rather than all to(ether as the CochranMantelHaenszel test does. The most common wa to test the homo(eneit of odds ratios is with the >reslow<a test" which & won%t cover here. ?ther statisticians will tell ou that it%s perfectl o!a to use the CochranMantelHaenszel test when the odds ratios are si(nificantl hetero(eneous. The different recommendations depend on what our (oal is. &f our main (oal is h pothesis testin(@ ou want to !now whether le(warmers reduce pain" in our e*ample@then the Cochran MantelHaenszel test is perfectl appropriate. ' si(nificant result will tell ou that es" the proportion of people feelin( an!le pain does depend on whether or not the %re wearin( le(warmers. &f our main
# MH

(oal is estimation@ ou want to estimate how well le(warmers wor! and come up with a number li!e Apeople with an!le arthritis are 51B less li!el to feel pain if the wear fluorescent pin! pol ester !nit le(warmersA@then it would be inappropriate to combine the data usin( the CochranMantelHaenszel test. &f le(warmers reduce pain b C1B in the winter" 51B in the sprin(" and /1B in the summer" it would be misleadin( to sa that the reduce pain b 51B; instead" it would be better to sa that the reduce pain" but the amount of pain reduction depends on the time of ear.

Examples
Mc<onald and =iebenaller (+,-,) surve ed allele fre6uencies at the Lap locus in the musselMytilus trossulus on the ?re(on coast. 't four estuaries" samples were ta!en from inside the estuar and from a marine habitat outside the estuar . There were three common alleles and a couple of rare alleles; based on previous results" the biolo(icall interestin( 6uestion was whether the Lap allele was less common inside estuaries" so all the other alleles were pooled into a Anon294A class. There are three nominal variables7 allele (,. or non2,.)" habitat (marine or estuarine)" and area (Tillamoo!" Ya6uina" 'lsea" or Dmp6ua). The null h pothesis is that at each area" there is no difference in the proportion of Eap alleles between the marine and estuarine habitats" after controllin( for area. This table shows the number of 94 and non294 alleles at each location. There is a smaller proportion of 94 alleles in the estuarine location of each estuar when compared with the marine location; we wanted to !now whether this difference is si(nificant.
94 ,.

Location Tillamoo!

Allele ,. non2,.

Marine 50 .1 0+

Estuarine 0, CC #5C

Ya6uina

,.

non2,. 'lsea ,. non2,. Dmp6ua ,. non2,.

5C C/ C+ C+ 55

/1+ 05 C, ..-

'ppl in( the formula (iven above" the numerator is /55.-." the denominator is C1..C" so the result is ; 95.15" + d.f." F91.1#5. You can re4ect the null h pothesis that the proportion ofLap alleles is the same in the marine and estuarine locations.
# MH ,.

Ga(non et al. (#11C) studied el! use of wildlife underpasses on a hi(hwa in 'rizona. Dsin( video surveillance cameras" the recorded each el! that started to cross under the hi(hwa . 3hen a car or truc! passed over while the el! was in the underpass" the recorded whether the el! continued throu(h the underpass (Acrossin(A) or turned around and left (AretreatA). The overall traffic volume was divided into low (fewer than . vehicles per minute) and hi(h. There are three nominal variables7 vehicle t pe (truc! or car)" traffic volume (low or hi(h)" and el! behavior (crossin( or retreat). The 6uestion is whether truc!s or cars are more li!el to scare el! out of underpasses. Crossin Eow traffic Car Truc! Hi(h traffic Car #-C .1 #/C !etreat 5C .# 5#

Truc!
# MH

5C

+#
2C

The result of the test is ; 9#../," + d.f." F9C.,$+1 . More el! are scared out of the underpasses b truc!s than b cars.

"raphin the results


To (raph the results of a CochranMantelHaenszel test" pic! one of the two values of the nominal variable that ou%re observin( and plot its proportions on a bar (raph" usin( bars of two different patterns.

Eap,. allele proportions in the mussel Mytilus trosulus at four ba s in ?re(on. Gra bars are marine samples and empt bars are estuarine samples. Hrror bars are ,5B confidence intervals.

#imilar tests
=ometimes the CochranMantelHaenszel test is 4ust called the MantelHaenszel test. This is confusin(" as there is also a test for homo(eneit of odds ratios called the MantelHaenszel test" and a MantelHaenszel test of independence for one #$# table. Mantel and Haenszel (+,5,) came up with a fairl minor modification of the basic idea of Cochran (+,5.)" so it seems appropriate (and somewhat less confusin() to (ive Cochran credit in the name of this test. &f ou have at least si* #$# tables" and ou%re onl interested in the direction of the differences in proportions" not the size of the differences" ou could do a si(n test. =ee the si(n test web pa(efor an e*ample of an e*periment with a ver similar desi(n to the Lap in Mytilus trossuluse*periment described above" where

because of the different biolo( of the or(anism" a si(n test was more appropriate. The CochranMantelHaenszel test for nominal variables is analo(ous to a two2wa anova orpaired t2test for a measurement variable" or a 3ilco*on si(ned2ran! test for ran! data. &n the arthritis2 le(warmers e*ample" if ou measured an!le pain on a +12point scale (a measurement variable) instead of cate(orizin( it as pain:no pain" ou%d anal ze the data with a two2wa anova.

How to do the test


#preadsheet
&%ve written a spreadsheet to perform the CochranMantel Haenszel test. &t handles up to 51 #$# tables (and ou should be able to modif it to handle more" if necessar ).

We$ pa es
&%m not aware of an web pa(es that will perform the Cochran MantelHaenszel test.

#A#
Here is a ='= pro(ram that uses FI?C )IHJ for a Cochran MantelHaenszel test. &t uses the mussel data from above. &n the T'>EH= statement" the variable that labels the repeats is listed first; in this case it is E?C'T&?K.

data lap; np!t l"cat "n # $ab tat # all%l% # c"!nt; ca&d'; ( lla)""* )a& n% +, 5( lla)""* %'t!a& n% +, -+ ( lla)""* )a& n% n"n.+, ,0 ( lla)""* %'t!a& n% n"n.+, // 0a1! na )a& n% +, -2 0a1! na %'t!a& n% +, 25/ 0a1! na )a& n% n"n.+, 5/ 0a1! na %'t!a& n% n"n.+, 302 3l'%a )a& n% +, /3 3l'%a %'t!a& n% +, -5 3l'%a )a& n% n"n.+, /2

3l'%a 4)p1!a 4)p1!a 4)p1!a 4)p1!a ; p&"c 6&%1 7% 8$t tabl%' &!n;

%'t!a& n% )a& n% %'t!a& n% )a& n% %'t!a& n%

n"n.+, +, +, n"n.+, n"n.+,

/+ /2 ,5 55 ,5

data=lap; c"!nt / 9%&"'; l"cat "n:$ab tat:all%l% / c)$;

There is a lot of output" but the important part loo!s li!e this7

;"c$&an<Mant%l<Ha%n'9%l =tat 't c' (>a'%d "n (abl% =c"&%') =tat 't c 3lt%&nat ?% H@p"t$%' ' AB Cal!% D&"b ................................................ ............... 2 E"n9%&" ;"&&%lat "n 2 5.320+ 0.0222 2 F"7 M%an =c"&%' A 66%& 2 5.320+ 0.0222 3 G%n%&al 3''"c at "n 2 5.320+ 0.0222
)or repeated #*# tables" the three statistics are identical; the are the CochranMantelHaenszel chi2s6uare statistic" without the continuit correction. )or repeated tables with more than two rows or columns" the A(eneral associationA statistic is used when the values of the different nominal variables do not have an order ( ou cannot arran(e them from smallest to lar(est); ou should use it unless ou have a (ood reason to use one of the other statistics.

%urther readin
=o!al and Iohlf" pp. C0.2C00.

!eferences
Ficture of )lashprance the pon from Fon Faradise. Cochran" 3.G. +,5.. =ome methods for stren(thenin( the common ; tests. >iometrics +17 .+C2.5+. Ga(non" L.3." T.C. Theimer" K.E. <odd" '.E. Manzon" and I.H. =chweinsbur(. #11C. Hffects of traffic on el! use of wildlife underpasses in 'rizona. L. 3ildl. Mana(e. C+7 #/#.2#/#-. Mantel" K." and 3. Haenszel. +,5,. =tatistical aspects of the anal sis of data from retrospective studies of disease. L. Katl. Cancer &nst. ##7 C+,2C.-. Mc<onald" L.H. and L.). =iebenaller. +,-,. =imilar (eo(raphic variation at the Lap locus in the mussels Mytilus trossulus and M. edulis. Hvolution ./7 ##-2#/+.
#

You might also like