


A study is done to investigate the effects of two binary factors, A and B, on a binary response, Y. Subjects are randomly selected from subpopulations defined by the four possible combinations of levels of A and B. The number of subjects responding with each level of Y is recorded, and the following DATA step creates the data set One:
data One;
do A=0,1;
do B=0,1;
do Y=1,2;
input F @@;
output;
end;
end;
end;
datalines;
23 63 31 70 67 100 70 104
;
The following statements fit a full model to examine the main effects of A and B as well as the interaction effect of A and B:
proc logistic data=One; freq F; model Y=A B A*B; run;
Results of the model fit are shown in Output 60.9.1. Notice that neither the A*B interaction nor the B main effect is significant.
Pearson and deviance goodness-of-fit tests cannot be obtained for this model because a full model containing four parameters
is fit, leaving no residual degrees of freedom. For a binary response model, the goodness-of-fit tests have
degrees of freedom, where m is the number of subpopulations and q is the number of model parameters. In the preceding model,
, resulting in zero degrees of freedom for the tests.
The following statements fit a reduced model containing only the A effect, so two degrees of freedom become available for testing goodness of fit. Specifying the SCALE=NONE
option requests the Pearson and deviance statistics. With single-trial syntax, the AGGREGATE=
option is needed to define the subpopulations in the study. Specifying AGGREGATE=(A B) creates subpopulations of the four
combinations of levels of A and B. Although the B effect is being dropped from the model, it is still needed to define the original subpopulations in the study. If AGGREGATE=(A)
were specified, only two subpopulations would be created from the levels of A, resulting in
and zero degrees of freedom for the tests.
proc logistic data=One; freq F; model Y=A / scale=none aggregate=(A B); run;
The goodness-of-fit tests in Output 60.9.2 show that dropping the B main effect and the A*B interaction simultaneously does not result in significant lack of fit of the model. The tests’ large p-values indicate insufficient evidence for rejecting the null hypothesis that the model fits.