The LOGISTIC Procedure

Receiver Operating Characteristic Curves

Receiver operating characteristic (ROC) curves are used to evaluate and compare the performance of diagnostic tests; they can also be used to evaluate model fit. An ROC curve is just a plot of the proportion of true positives (events predicted to be events) versus the proportion of false positives (nonevents predicted to be events).

In a sample of n individuals, suppose that n 1 individuals are observed to have a certain condition or event, indicated by Y = 1; denote this group as script upper C 1. Let the remaining n 2 equals n minus n 1 individuals who do not have the condition be indicated by Y = 2, and denote this group as script upper C 2. Risk factors are identified for the sample, and a logistic regression model is fitted to the data. For the jth individual, an estimated probability ModifyingAbove pi With caret Subscript j of the event of interest is calculated. By default, the ModifyingAbove pi With caret Subscript j are computed as shown in the section Linear Predictor, Predicted Probability, and Confidence Limits; you can use the cross validated probabilities (discussed in the section Classification Table) by specifying the CROSSVALIDATE suboption of the ROCOPTIONS option.

Suppose that the n individuals undergo a test for predicting the event and that the test is based on the estimated probability of the event. Higher values of this estimated probability are assumed to be associated with the event. Define this test as a decision rule, D, which classifies an observation as an event when ModifyingAbove pi With caret greater-than-or-equal-to z; D = 1 indicates that the observation is classified as an event, and D = 2 indicates that the observation is classified as a nonevent. You can construct an ROC curve by varying the cutpoint z that determines which estimated event probabilities are considered to predict the event. For a given cutpoint, the resulting 2 times 2 classification table is shown in Table 13, where n Subscript i j is the total number of observations that are observed to have Y = i and are classified into D = j.

Table 13: Classification Matrix for Cutpoint z

ModifyingAbove pi With caret greater-than-or-equal-to z (upper D equals 1) ModifyingAbove pi With caret less-than z (upper D equals 2) Total
script upper C 1 left-parenthesis upper Y equals 1 right-parenthesis (event) n 11 n 12 n 1
script upper C 2 left-parenthesis upper Y equals 2 right-parenthesis (nonevent) n 21 n 22 n 2


For each cutpoint z, you can output the measures in Table 14 to a data set by specifying the OUTROC= option in the MODEL statement or the OUTROC= option in the SCORE statement.

Table 14: Statistics from the Classification Matrix with Cutpoint z

Statistic Equation Description
_PROB_ z Cutpoint
_POS_ n 11 Number of correctly predicted event responses
_NEG_ n 22 Number of correctly predicted nonevent responses
_FALPOS_ n 12 Number of falsely predicted event responses
_FALNEG_ n 21 Number of falsely predicted nonevent responses
_SENSIT_ StartFraction n 11 Over n 1 EndFraction Sensitivity of the test
_1MSPEC_ StartFraction n 21 Over n 2 EndFraction One minus the specificity of the test


The ROC curve is a plot of sensitivity (_SENSIT_) against 1–specificity (_1MSPEC_). The plot can be produced by using the PLOTS option or by using the GPLOT or SGPLOT procedure with the OUTROC= data set. See Example 79.7 for an illustration. The area under the ROC curve, as determined by the trapezoidal rule, is estimated by the concordance index, c, in the "Association of Predicted Probabilities and Observed Responses" table.

Comparing ROC Curves

ROC curves can be created from each model fit in a selection routine, from the specified model in the MODEL statement, from specified models in ROC statements, or from input variables which act as ModifyingAbove pi With caret in the preceding discussion. Association statistics are computed for these models, and the models are compared when the ROCCONTRAST statement is specified. The ROC comparisons are performed by using a contrast matrix to take differences of the areas under the empirical ROC curves (DeLong, DeLong, and Clarke-Pearson 1988). For example, if you have three curves and the second curve is the reference, the contrast used for the overall test is

bold upper L 1 equals StartBinomialOrMatrix bold-italic l prime 1 Choose bold-italic l prime 2 EndBinomialOrMatrix equals Start 2 By 3 Matrix 1st Row 1st Column 1 2nd Column negative 1 3rd Column 0 2nd Row 1st Column 0 2nd Column negative 1 3rd Column 1 EndMatrix

and you can optionally estimate and test each row of this contrast, in order to test the difference between the reference curve and each of the other curves. If you do not want to use a reference curve, the global test optionally uses the following contrast:

bold upper L 2 equals StartBinomialOrMatrix bold-italic l prime 1 Choose bold-italic l prime 2 EndBinomialOrMatrix equals Start 2 By 3 Matrix 1st Row 1st Column 1 2nd Column negative 1 3rd Column 0 2nd Row 1st Column 0 2nd Column 1 3rd Column negative 1 EndMatrix

You can also specify your own contrast matrix. Instead of estimating the rows of these contrasts, you can request that the difference between every pair of ROC curves be estimated and tested. Demler, Pencina, and D’Agostino (2012) caution that testing the difference in the AUC between two nested models is not a valid approach if the added predictor is not significantly associated with the response; in any case, if you use this approach, you are more likely to fail to reject the null.

By default for the reference contrast, the specified or selected model is used as the reference unless the NOFIT option is specified in the MODEL statement, in which case the first ROC model is the reference.

In order to label the contrasts, a name is attached to every model. The name for the specified or selected model is the MODEL statement label, or "Model" if the MODEL label is not present. The ROC statement models are named with their labels, or as "ROCi" for the ith ROC statement if a label is not specified. The contrast bold upper L 1 is labeled as "Reference = ModelName", where ModelName is the reference model name, while bold upper L 2 is labeled "Adjacent Pairwise Differences". The estimated rows of the contrast matrix are labeled "ModelName1 – ModelName2". In particular, for the rows of bold upper L 1, ModelName2 is the reference model name. If you specify your own contrast matrix, then the contrast is labeled "Specified" and the ith contrast row estimates are labeled "Rowi".

If ODS Graphics is enabled, then all ROC curves are displayed individually and are also overlaid in a final display. If a selection method is specified, then the curves produced in each step of the model selection process are overlaid onto a single plot and are labeled "Stepi", and the selected model is displayed on a separate plot and on a plot with curves from specified ROC statements. See Example 79.8 for an example.

ROC Computations

The trapezoidal area under an empirical ROC curve is equal to the Mann-Whitney two-sample rank measure of association statistic (a generalized U-statistic) applied to two samples, StartSet upper X Subscript i Baseline EndSet comma i equals 1 comma ellipsis comma n 1, in script upper C 1 and StartSet upper Y Subscript i Baseline EndSet comma i equals 1 comma ellipsis comma n 2, in script upper C 2. PROC LOGISTIC uses the predicted probabilities in place of bold upper X and bold upper Y; however, in general any criterion could be used. Denote the frequency of observation i in script upper C Subscript k as f Subscript k i, and denote the total frequency in script upper C Subscript k as upper F Subscript k. The WEIGHTED option replaces f Subscript k i with f Subscript k i Baseline w Subscript k i, where w Subscript k i is the weight of observation i in group script upper C Subscript k. The trapezoidal area under the curve is computed as

StartLayout 1st Row 1st Column ModifyingAbove c With caret 2nd Column equals 3rd Column StartFraction 1 Over upper F 1 upper F 2 EndFraction sigma-summation Underscript i equals 1 Overscript n 1 Endscripts sigma-summation Underscript j equals 1 Overscript n 2 Endscripts psi left-parenthesis upper X Subscript i Baseline comma upper Y Subscript j Baseline right-parenthesis f Subscript 1 i Baseline f Subscript 2 j 2nd Row 1st Column psi left-parenthesis upper X comma upper Y right-parenthesis 2nd Column equals 3rd Column StartLayout Enlarged left-brace 1st Row 1st Column 1 2nd Column upper Y less-than upper X 2nd Row 1st Column one-half 2nd Column upper Y equals upper X 3rd Row 1st Column 0 2nd Column upper Y greater-than upper X EndLayout EndLayout

so that upper E left-parenthesis ModifyingAbove c With caret right-parenthesis equals probability left-parenthesis upper Y less-than upper X right-parenthesis plus one-half probability left-parenthesis upper Y equals upper X right-parenthesis. Note that the concordance index, c, in the "Association of Predicted Probabilities and Observed Responses" table does not use weights unless both the WEIGHTED and BINWIDTH=0 options are in effect.

To compare K empirical ROC curves, first compute the trapezoidal areas. Asymptotic normality of the estimated area follows from U-statistic theory, and a covariance matrix bold upper S can be computed; For more information, see DeLong, DeLong, and Clarke-Pearson (1988). A Wald confidence interval for the rth area, 1 less-than-or-equal-to r less-than-or-equal-to upper K, can be constructed as

ModifyingAbove c With caret Subscript r Baseline plus-or-minus z Subscript 1 minus StartFraction alpha Over 2 EndFraction Baseline s Subscript r comma r

where s Subscript r comma r is the rth diagonal of bold upper S.

For a contrast of ROC curve areas, bold upper L bold c, the statistic

left-parenthesis ModifyingAbove bold c With caret minus bold c right-parenthesis prime bold upper L prime left-bracket bold upper L bold upper S bold upper L prime right-bracket Superscript negative 1 Baseline bold upper L left-parenthesis ModifyingAbove bold c With caret minus bold c right-parenthesis

has a chi-square distribution with df=rank(bold upper L bold upper S bold upper L prime). For a row of the contrast, bold-italic l prime bold c,

StartFraction bold-italic l prime ModifyingAbove bold c With caret minus bold-italic l prime bold c Over left-bracket bold-italic l prime bold upper S bold-italic l right-bracket Superscript 1 slash 2 Baseline EndFraction

has a standard normal distribution. The corresponding confidence interval is

bold-italic l prime ModifyingAbove bold c With caret plus-or-minus z Subscript 1 minus StartFraction alpha Over 2 EndFraction Baseline left-bracket bold-italic l prime bold upper S bold-italic l right-bracket Superscript 1 slash 2
Last updated: March 08, 2022