The LOGISTIC Procedure

Example 73.9 Goodness-of-Fit Tests and Subpopulations

(View the complete code for this example.)

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 73.9.1. Notice that neither the A*B interaction nor the B main effect is significant.

Output 73.9.1: Full Model Fit

The LOGISTIC Procedure

Model Information
Data SetWORK.ONE
Response VariableY
Number of Response Levels2
Frequency VariableF
Modelbinary logit
Optimization TechniqueFisher's scoring

Number of Observations Read8
Number of Observations Used8
Sum of Frequencies Read528
Sum of Frequencies Used528

Response Profile
Ordered
Value
YTotal
Frequency
11191
22337

Probability modeled is Y=1.


Model Convergence Status
Convergence criterion (GCONV=1E-8) satisfied.

Model Fit Statistics
CriterionIntercept OnlyIntercept and
Covariates
AIC693.061691.914
SC697.330708.990
-2 Log L691.061683.914

Testing Global Null Hypothesis: BETA=0
TestChi-SquareDFPr > ChiSq
Likelihood Ratio7.147830.0673
Score6.992130.0721
Wald6.911830.0748

Analysis of Maximum Likelihood Estimates
ParameterDFEstimateStandard
Error
Wald
Chi-Square
Pr > ChiSq
Intercept1-1.00740.243617.1015<.0001
A10.60690.29034.37140.0365
B10.19290.32540.35150.5533
A*B1-0.18830.39330.22930.6321


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 73.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.

Output 73.9.2: Reduced Model Fit

The LOGISTIC Procedure

Deviance and Pearson Goodness-of-Fit Statistics
CriterionValueDFValue/DFPr > ChiSq
Deviance0.354120.17700.8377
Pearson0.353120.17650.8382

Number of unique profiles: 4