The FREQ Procedure
Example 2.10 Cochran’s Q Test
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 repeated-measures model.
The data set Drugs contains data for a study of three drugs to treat a chronic disease (Agresti 2002). Forty-six 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';
run;
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 one-way frequency tables of the responses to each drug. The AGREE option produces Cochran’s Q and other measures of agreement for the three-way table. These statements produce Output 2.10.1 through Output 2.10.5.
proc freq data=Drugs;
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.;
weight Count;
title 'Study of Three Drug Treatments for a Chronic Disease';
run;
The one-way frequency tables in Output 2.10.1 provide the marginal response for each drug. For drugs A and B, 61% of the subjects reported a favorable response; for drug C, 35% of the subjects reported a favorable response. Output 2.10.2 and Output 2.10.3 display measures of agreement for the 'Favorable' and 'Unfavorable' levels of drug A, respectively. McNemar’s test shows a strong discordance between drugs B and C when the response to drug A is favorable.
Output 2.10.1: One-Way 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 |
Output 2.10.2: Measures of Agreement for Drug A Favorable
| McNemar's Test | ||
|---|---|---|
| Chi-Square | DF | Pr > ChiSq |
| 10.8889 | 1 | 0.0010 |
| Simple Kappa Coefficient | |||
|---|---|---|---|
| Estimate | Standard Error | 95% Confidence Limits | |
| -0.0328 | 0.1167 | -0.2615 | 0.1960 |
Output 2.10.3: Measures of Agreement for Drug A Unfavorable
| McNemar's Test | ||
|---|---|---|
| Chi-Square | DF | Pr > ChiSq |
| 0.4000 | 1 | 0.5271 |
| Simple Kappa Coefficient | |||
|---|---|---|---|
| Estimate | Standard Error | 95% Confidence Limits | |
| -0.1538 | 0.2230 | -0.5909 | 0.2832 |
Output 2.10.4 displays the overall kappa coefficient. The small negative value of kappa indicates no agreement between drug B response and drug C response.
Output 2.10.4: Overall Measures of Agreement
| Overall Kappa Coefficient | |||
|---|---|---|---|
| Estimate | Standard Error | 95% Confidence Limits | |
| -0.0588 | 0.1034 | -0.2615 | 0.1439 |
| Test for Equal Kappas | ||
|---|---|---|
| Chi-Square | DF | Pr > ChiSq |
| 0.2314 | 1 | 0.6305 |
Cochran’s Q is statistically significant (p=0.0145 in Output 2.10.5), which leads to rejection of the hypothesis that the probability of favorable response is the same for the three drugs.
Output 2.10.5: Cochran’s Q Test
| Cochran's Q, for Drug_A by Drug_B by Drug_C | ||
|---|---|---|
| Chi-Square | DF | Pr > ChiSq |
| 8.4706 | 2 | 0.0145 |