The LOGISTIC Procedure

Example 73.7 ROC Curve, Customized Odds Ratios, Goodness-of-Fit Statistics, R-Square, and Confidence Limits

(View the complete code for this example.)

This example plots an ROC curve, estimates a customized odds ratio, produces the traditional goodness-of-fit analysis, displays the generalized R-square measures for the fitted model, calculates the normal confidence intervals for the regression parameters, and produces a display of the probability function and prediction curves for the fitted model. The data consist of three variables: n (number of subjects in the sample), disease (number of diseased subjects in the sample), and age (age for the sample). A linear logistic regression model is used to study the effect of age on the probability of contracting the disease. The statements to produce the data set and perform the analysis are as follows:

data Data1;
   input disease n age;
   datalines;
 0 14 25
 0 20 35
 0 19 45
 7 18 55
 6 12 65
17 17 75
;
ods graphics on;
%let _ROC_XAXISOPTS_LABEL=False Positive Fraction;
%let _ROC_YAXISOPTS_LABEL=True Positive Fraction;
proc logistic data=Data1 plots(only)=roc(id=obs);
   model disease/n=age / scale=none
                         clparm=wald
                         clodds=pl
                         rsquare;
   units age=10;
   effectplot;
run;
%symdel _ROC_XAXISOPTS_LABEL _ROC_YAXISOPTS_LABEL;

The option SCALE=NONE is specified to produce the deviance and Pearson goodness-of-fit analysis without adjusting for overdispersion. The RSQUARE option is specified to produce generalized R-square measures of the fitted model. The CLPARM=WALD option is specified to produce the Wald confidence intervals for the regression parameters. The UNITS statement is specified to produce customized odds ratio estimates for a change of 10 years in the age variable, and the CLODDS=PL option is specified to produce profile-likelihood confidence limits for the odds ratio. The PLOTS= option with ODS Graphics enabled produces a graphical display of the ROC curve, the two macro variables modify the ROC axis labels, and the EFFECTPLOT statement displays the model fit.

The results in Output 73.7.1 show that the deviance and Pearson statistics indicate no lack of fit in the model.

Output 73.7.1: Deviance and Pearson Goodness-of-Fit Analysis

The LOGISTIC Procedure

Deviance and Pearson Goodness-of-Fit Statistics
CriterionValueDFValue/DFPr > ChiSq
Deviance7.775641.94390.1002
Pearson6.602041.65050.1585

Number of events/trials observations: 6



Output 73.7.2 shows that the R-square for the model is 0.74. The odds of an event increases by a factor of 7.9 for each 10-year increase in age.

Output 73.7.2: R-Square, Confidence Intervals, and Customized Odds Ratio

Model Fit Statistics
CriterionIntercept OnlyIntercept and Covariates
Log LikelihoodFull Log Likelihood
AIC124.17352.46818.075
SC126.77857.67823.285
-2 Log L122.17348.46814.075

R-Square0.5215Max-rescaled R-Square0.8925

Testing Global Null Hypothesis: BETA=0
TestChi-SquareDFPr > ChiSq
Likelihood Ratio73.70481<.0001
Score55.32741<.0001
Wald23.34751<.0001

Analysis of Maximum Likelihood Estimates
ParameterDFEstimateStandard
Error
Wald
Chi-Square
Pr > ChiSq
Intercept1-12.50162.555523.9317<.0001
age10.20660.042823.3475<.0001

Association of Predicted Probabilities and
Observed Responses
Percent Concordant92.6Somers' D0.906
Percent Discordant2.0Gamma0.958
Percent Tied5.4Tau-a0.384
Pairs2100c0.953

Parameter Estimates and Wald Confidence
Intervals
ParameterEstimate95% Confidence Limits
Intercept-12.5016-17.5104-7.4929
age0.20660.12280.2904

Odds Ratio Estimates and Profile-Likelihood
Confidence Intervals
EffectUnitEstimate95% Confidence Limits
age10.00007.8923.88121.406


Because ODS Graphics is enabled, a graphical display of the ROC curve is produced as shown in Output 73.7.3.

Output 73.7.3: Receiver Operating Characteristic Curve

Receiver Operating Characteristic Curve


Note that the area under the ROC curve is estimated by the statistic c in the "Association of Predicted Probabilities and Observed Responses" table. In this example, the area under the ROC curve is 0.953. By default, the Y axis is labeled "Sensitivity" and the X axis is labeled "1–Specificity".

Because there is only one continuous covariate and because ODS Graphics is enabled, the EFFECTPLOT statement produces a graphical display of the predicted probability curve with bounding 95% confidence limits as shown in Output 73.7.4.

Output 73.7.4: Predicted Probability and 95% Prediction Limits

Predicted Probability and 95% Prediction Limits