Example 28.9: Testing Marginal Homogeneity with Cochran's Q
When a binary response is measured several times or under
different conditions, Cochran's Q tests that the marginal
probability of a positive response is unchanged across the
times or conditions. When there are more than two response
categories, you can use the CATMOD procedure to fit a
repeatedmeasures model.
The data set Drugs contains data for a study of three
drugs to treat a chronic disease (Agresti 1990). Fortysix subjects
receive drugs A, B, and C. The response to each drug is
either favorable ('F') or unfavorable ('U').
proc format;
value $ResponseFmt 'F'='Favorable'
'U'='Unfavorable';
data drugs;
input Drug_A $ Drug_B $ Drug_C $ Count @@;
datalines;
F F F 6 U F F 2
F F U 16 U F U 4
F U F 2 U U F 6
F U U 4 U U U 6
;
The following statements create oneway frequency tables of
the responses to each drug. The AGREE option produces
Cochran's Q and other measures of agreement for the
threeway table. These statements produce Output 28.9.1
through Output 28.9.3.
proc freq data=Drugs;
weight Count;
tables Drug_A Drug_B Drug_C / nocum;
tables Drug_A*Drug_B*Drug_C / agree noprint;
format Drug_A Drug_B Drug_C $ResponseFmt.;
title 'Study of Three Drug Treatments for a Chronic Disease';
run;
Output 28.9.1: OneWay Frequency Tables
Study of Three Drug Treatments for a Chronic Disease 
Drug_A 
Frequency 
Percent 
Favorable 
28 
60.87 
Unfavorable 
18 
39.13 
Drug_B 
Frequency 
Percent 
Favorable 
28 
60.87 
Unfavorable 
18 
39.13 
Drug_C 
Frequency 
Percent 
Favorable 
16 
34.78 
Unfavorable 
30 
65.22 

The oneway frequency tables in Output 28.9.1 provide the
marginal response for each drug. For drugs A and B, 61% of
the subjects reported a favorable response while 35% of the
subjects reported a favorable response to drug C.
Output 28.9.2: Measures of Agreement
Study of Three Drug Treatments for a Chronic Disease 
Statistics for Table 1 of Drug_B by Drug_C Controlling for Drug_A=Favorable 
McNemar's Test 
Statistic (S) 
10.8889 
DF 
1 
Pr > S 
0.0010 
Simple Kappa Coefficient 
Kappa 
0.0328 
ASE 
0.1167 
95% Lower Conf Limit 
0.2615 
95% Upper Conf Limit 
0.1960 
Statistics for Table 2 of Drug_B by Drug_C Controlling for Drug_A=Unfavorable 
McNemar's Test 
Statistic (S) 
0.4000 
DF 
1 
Pr > S 
0.5271 
Simple Kappa Coefficient 
Kappa 
0.1538 
ASE 
0.2230 
95% Lower Conf Limit 
0.5909 
95% Upper Conf Limit 
0.2832 

Study of Three Drug Treatments for a Chronic Disease 
Summary Statistics for Drug_B by Drug_C Controlling for Drug_A 
Overall Kappa Coefficient 
Kappa 
0.0588 
ASE 
0.1034 
95% Lower Conf Limit 
0.2615 
95% Upper Conf Limit 
0.1439 
Test for Equal Kappa Coefficients 
ChiSquare 
0.2314 
DF 
1 
Pr > ChiSq 
0.6305 

McNemar's test (Output 28.9.2) shows strong discordance
between drugs B and C when the response to drug A is
favorable. The small negative value of the simple kappa indicates
no agreement between drug B response and drug C response.
Output 28.9.3: Cochran's Q
Study of Three Drug Treatments for a Chronic Disease 
Summary Statistics for Drug_B by Drug_C Controlling for Drug_A 
Cochran's Q, for Drug_A by Drug_B by Drug_C 
Statistic (Q) 
8.4706 
DF 
2 
Pr > Q 
0.0145 

Cochran's Q is statistically significant (p=0.0144 in
Output 28.9.3), which leads to rejection of the hypothesis
that the probability of favorable response is the same
for the three drugs.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.