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 72.7.1 show that the deviance and Pearson statistics indicate no lack of fit in the model.
Output 72.7.1: Deviance and Pearson Goodness-of-Fit Analysis
Output 72.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 72.7.2: R-Square, Confidence Intervals, and Customized Odds Ratio
Because ODS Graphics is enabled, a graphical display of the ROC curve is produced as shown in Output 72.7.3.
Output 72.7.3: 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 72.7.4.
Output 72.7.4: Predicted Probability and 95% Prediction Limits