Example: quiz answers

382-2008: Generalized McNemar's Test for …

Paper 382-2008 Generalized mcnemar s Test for Homogeneity of theMarginal DistributionsXuezheng Sun1, Zhao Yang21 Department of Epidemiology and BiostatisticsUniversity of South Carolina, Columbia, SC 29208, USA2 Premier Research Group Parkway Place, Suite 820, Marietta, GA 30067, USASUMMARYIn the matched-pairs data, mcnemar s test ( mcnemar , 1947) can be applied only to the case in whichthere are two possible categories for the outcome. In practice, however, it is possible that the outcomes areclassified into multiple categories. Under this situation, the test statistic proposed by Stuart (1955) andMaxwell (1970) is useful, it is actually the generalization of the mcnemar s test, commonly referred to asgeneralized mcnemar s or Stuart-Maxwell test. There is no public available SAS program to calculate thisstatistic, the author has developed a SAS macro (the code is detailed in appendix) to perform this testand briefly describes how to use the macro.

Paper 382-2008 Generalized McNemar’s Test for Homogeneity of the Marginal Distributions Xuezheng Sun1, Zhao Yang2 1 Department of Epidemiology and Biostatistics University of South Carolina, Columbia, SC 29208, USA

Tags:

  Tests, Mcnemar s test, Mcnemar

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of 382-2008: Generalized McNemar's Test for …

1 Paper 382-2008 Generalized mcnemar s Test for Homogeneity of theMarginal DistributionsXuezheng Sun1, Zhao Yang21 Department of Epidemiology and BiostatisticsUniversity of South Carolina, Columbia, SC 29208, USA2 Premier Research Group Parkway Place, Suite 820, Marietta, GA 30067, USASUMMARYIn the matched-pairs data, mcnemar s test ( mcnemar , 1947) can be applied only to the case in whichthere are two possible categories for the outcome. In practice, however, it is possible that the outcomes areclassified into multiple categories. Under this situation, the test statistic proposed by Stuart (1955) andMaxwell (1970) is useful, it is actually the generalization of the mcnemar s test, commonly referred to asgeneralized mcnemar s or Stuart-Maxwell test. There is no public available SAS program to calculate thisstatistic, the author has developed a SAS macro (the code is detailed in appendix) to perform this testand briefly describes how to use the macro.

2 Examples using the developed SAS macro are also :Matched-pairs data; Marginal Homogeneity; mcnemar s test; Generalized mcnemar s test(Stuart-Maxwell test); SAS/IML; data commonly occur in studies with repeated measurement of subjects, such as longitudinalstudies that observe subjects over time, in a 2 2 crossover clinical trial study, we may concern withthe changes of interested endpoint between 2 treatment period; or symptom ratings by two raters onthe same sample of subjects. Because of the matching, the responses in the two samples are statisticallydependent. For matched pairs with a categorical response, a two-way contingency table with the samerow and column categories summarizes the data, under this situation, the contingency table is also calledsquare , letYandZdenote the two categorical response variable withrcategories for matched-pairs of subjects on both variables haver2possible combinations, an example of square table isshown in Table 1 (The number,ni,j, i, j= 1,2, , r, in the parenthesis is the frequency).

3 Table 1: Cross-classification of square r 1rTotal1 1,1(n1,1) 1,2(n1,2) 1,r 1(n1,r 1) 1,r(n1,r) 1,+(n1,+)2 2,1(n2,1) 2,2(n2,2) 2,r 1(n2,r 1) 2,r(n2,r) 2,+(n2,+)..r 1 r 1,1(nr 1,1) r 1,2(nr 1,2) r 1,r 1(nr 1,r 1) r 1,r(nr 1,r) r 1,+(nr 1,+)r r,1(nr,1) r,2(nr,2) r,r 1(nr,r 1) r,r(nr,r) r,+(nr,+)Total +,1(n+,1) +,1(n+,2) +,r 1(n+,r 1) +,r(n+,r) +,+(n+,+)1 Statistics and Data AnalysisSASG lobalForum2008 In Table 1, let i,j, i, j= 1,2, , rdenote the probability that (Y, Z) occurs in the cell in rowiand columnj. The probability distribution{ ij}is the joint distribution ofYandZ. The marginal distributions arethe row and column totals that result from summing the joint probabilities. We denote these by{ i,+}for the row variable and{ +,j}for the column variable, where the subscript + denotes the sum overthat index; that is i,+=r j=1 i,j, +,j=r i=1 i,j,andr i=1 i,+=r j=1 +,j=r i=1r j=1 i,j= 1 Therefore, the marginal distributions provide single-variable OF MARGINAL HOMOGENEITYM arginal homogeneity refers to equality (lack of significant difference) between one or more of the rowmarginal proportions and the corresponding column proportion(s).

4 Formally, using the notation in Table 1,we are actually testingP(Y=s) = P(Z=s) s,+= +,s,fors= 1,2, , r(1)Lettingds= +,s s,+and lettingd= (d1, , dr 1), we may see that it is redundant to includedrinthe vectord, since we have ri=1 i,+= 1 (or rj=1 +,j= 1) and rs=1ds= 0, hence, generally therearer 1 degree of freedom is the statistics used for testing marginal homogeneity is distributed as a 2distribution. Therefore, marginal homogeneity occurs when the row totals are equal to the column totals,in the medical research, a common interpretation to the marginal homogeneity would mean there wasno effect of the treatment.(a) mcnemar s TestIn statistics, mcnemar s test is a non-parametric method used on nominal data to determine whether therow and column marginal frequencies are equal. It is named after Q. mcnemar , who introduced it in is applied to 2 2 contingency tables with a dichotomous categories with matched pairs of there are only two categories,r= 2, using the test hypothesis in (1), 1,+= +,1, and datastructure in Table 1, the mcnemar s test statistic is given asZ=(n21 n12)2n21+n12 21(2)where the mcnemar statistic is a chi-squared statistic with 1 degree of freedom.

5 In the small samplesituation, continuity-correction will be applied to the above formula, (7). An interesting observationwhen interpreting mcnemar s test is that the elements of the main diagonal contribute no informationwhatsoever to the decision if pre- or post-treatment condition is more mcnemar chi-square test is the procedure of choice assessing marginal homogeneity for repeateddichotomous measures. The research question of interest is whether or not is it reasonable to describe themarginal response rates for, say, a favorable one as equivalent ( , homogeneous).(b) Generalized mcnemar /Stuart-Maxwell TestThe generalization of mcnemar s test to square tables larger than 2 2 is often referred to as the generalizedMcNemar or Stuart-Maxwell test (Stuart, 1955; Maxwell, 1970). To test the series of hypothesis (1), weare actually interested in the mean vector and variance-covariance matrix of vectord.

6 Clearly, under themarginal homogeneity, we have E (d) = 0. And the variance-covariance matrix of vector Nd,V, is(r 1) (r 1) dimension, the typical elements of Vare st= ( st+ ts),fort6=sandt, s= 1, , r 1(3) ss= s++ +s 2 ss,fors= 1, , r 1(4)whereN=n+,+, the total sample size. Stuart (1955) proposed the statisticZ0=Nd V 1d=Nd (N V) 1Nd 2r 1(5)2 Statistics and Data AnalysisSASG lobalForum2008 Since we have the relationshipN( st+ ts) =nst+nts;N( s++ +s 2 ss) =ns++n+s 2nsshold,the calculation ofZ0can then be based on the frequency in ther rsquare the so-calledgeneralized mcnemar s test statistic or Stuart-Maxwell test statistic. AndZ0is distributed as a chi-squared distribution withr 1 degree of freedom. Whenr= 2, the Generalized mcnemar s test statistic(or Stuart-Maxwell test statistic)Z0will be reduced to mcnemar s statistic in (7).

7 Forr= 3, we also havea closed-form formula (Walker, 2002) to calculateZ0. After defining the following items, we then can gettheZ0,d1= (n12+n13) (n21+n31)d2= (n21+n23) (n12+n32)d3= (n31+n32) (n13+n23)nij=nij+nji2,fori6=jZ0=n23d21+n 13d22+n12d232 (n12n23+n12n13+n13n23)(6)(c) Bhapkar s testBhapkar (1966) tested marginal homogeneity by exploiting the asymptotic normality of marginal propor-tion, and this test is also called Bhapkar s test. The idea of constructing test statistic is similar to theone of Generalized mcnemar s test statistic, and the major difference lies in the calculation of elements invariance-covariance matrix V, the typical elements are st= ( st+ ts) ( +s s+)( +t t+),fort6=sandt, s= 1, , r 1(7) ss= s++ +s 2 ss ( +s s+)2,fors= 1, , r 1(8)The Bhapkar s test statistic (1966) is alsoZ1=Nd V 1d=Nd (N2 V) 1N2d 2r 1(9)And Ireland et al (1969) noticed the relationship between the Generalized mcnemar s test statistic and theBhapkar s test statistic asZ1=Z01 Z0/N(10)Although the Bhapkar and Stuart-Maxwell tests are asymptotically equivalent (Keefe, 1982).

8 Generally,the Bhapkar (1966) test is a more powerful alternative to the Stuart-Maxwell test. With a largeN, bothwill produce the same chi-squared value. As the Bhapkar test is more powerful, it is DEVELOPMENT FOR Generalized mcnemar /Stuart-Maxwell TESTThe SAS system provides the easily-accessed calculation for mcnemar s test (using optionAGREEinTABLE statement of SAS/STAT procedureFREQ) and Bhapkar s test (using theREPEATED statement inthe SAS/STAT procedureCATMOD), however, there are no public available SAS code to perform the cal-culation and test using Generalized mcnemar /Stuart-Maxwell test statistic. Some sample SAS code forMcNemar s test and Bhapkar s test will be presented in the following section as a comparison among thetest results. In this section, a brief summary to the developed macro %gMcNemarwas presented, the SAScode is detailed in the developed macro %gMcNemarhas four parameters%gMcNemar( DSIN = , /* INPUT DATASET*/ROWV = , /* ROW VARAIBLE NAME */COLV = , /* COLUMN VARIABLE NAME */COUNT = ); /* CELL COUNT VARIABLE NAME OF R X R SQUARE TABLE*/The parameterCOUNT corresponds to thenijin Table 1.

9 And the current version of macro can only beapplied to the compiled dataset, however, only some simple modifications are needed to make the macroapplicable to the raw dataset, the raw data of Table in Walker s book (2002, )3 Statistics and Data AnalysisSASG lobalForum2008 The output of the macro includes the Generalized mcnemar s test statisticGMN, the degree of freedom of 2distributed Generalized mcnemar s test statisticDFand the correspondingp valuePROBCHI. Also, the95% and 99% quantile of 2distribution with degree of freedomDFare provided asQCHI95andQCHI99, STUDIESThis part includes three examples of applying the developed macro. To make sure the macro workscorrectly, all three examples are taken from Stuart (1955) and Walker (2002), in which there are givencalculated results. The calculated statistics from the developed macro for the following examples areconsistent with the given results in Stuart (1955) and Walker (2002).

10 (a) Unaided Distance VisionThe data, provided in Table 2, is taken from the example of Stuart (1955). The computation was shownvia a step-by-step procedure, and the Generalized mcnemar s statistic was calculated as (Stuart,1955).Table 2: 7477 Women Aged 30-39; Unaided Distance EyeRight EyeHighest Grade Second Grade Third Grade Lowest Grade TotalHighest Grade1520266124661976 Second Grade2341512432782256 Third Grade11736217722052456 Lowest Grade3682179492789 Total1907222225078417477 The following code first creates the dataset, then call the developed macro for calculation. We may noticefrom the output that the resulting Generalized mcnemar s test statistic is , same as the one inStuart s paper (1955), and the statistic is approximately distributed as 2with degree of freedom 3, thecorrespondingp value is Meanwhile, the 95% and 99% quantile of 2with degree of freedom 3 arealso provided in the output as and , Vision;input r c count @@;cards;1 1 1520 1 2 266 1 3 124 1 4 66 2 1 234 2 2 1512 2 3 432 2 4 78 3 1 1173 2 362 3 3 1772 3 4 205 4 1 36 4 2 82 4 3 179 4 4 492;%gMcNemar(dsin = Vision, rowv = r, colv = c, count = count);Output:GMN DF 3 make a comparison, the SAS code and its corresponding output usingPROC CATMODto calculate Bhap-kar s test statistic was also provided in the following,proc catmod data = Vision;weight count;response marginals.


Related search queries