SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 25017: Nonparametric comparison of areas under correlated ROC curves

DetailsResultsDownloadsAboutRate It

Nonparametric comparison of areas under correlated ROC curves

Contents: Purpose / History / Requirements / Usage / Details / Limitations / Missing Values / See Also / References

NOTE: Beginning in SAS 9.2, comparison of areas under correlated ROC curves can be done using the ROC and ROCCONTRAST statements in PROC LOGISTIC. Examples are provided in the Results tab. See the PROC LOGISTIC documentation for additional details and examples.

NOTE: Indicated portions of the SAS/IML code in this sample program were provided, and are supported, by the author D.M. DeLong (see REFERENCES below).
PURPOSE:
Nonparametric comparison of areas under correlated ROC curves. Provides point and confidence interval estimates of each curve's area and of the pairwise differences among the areas. Tests of the pairwise differences are also given. Any contrast among the areas may be estimated and tested.
HISTORY:
Version
Update Notes
1.7Fixed row labeling when CONTRAST= option is specified.
1.6Removed computation of estimated correlations to avoid problems with use of intercept-only model. Fix to automatic check for new version.
1.5Fixed subscript error in RNAME with 15 or more data sets and XBETA variables. Added automatic check for new version.
1.4Corrected errors with default contrast and only one variable specified in VAR=. The single area is now estimated and tested.
1.3Added confidence intervals for each area. Added ALPHA= parameter to control confidence level. Default contrasts are now all pairwise differences. Added table of confidence intervals and tests of each contrast row.
1.2Put original author's code in macro form. Allow input of several data sets to compare several models which may each have multiple predictors. Default contrast set generated. Added DETAILS= parameter to minimize default output. Creates macro variable with overall p-value.
REQUIREMENTS:
Version 7 or later of Base SAS and SAS/IML.
USAGE:
Follow the instructions in the Downloads tab of this sample to save the %ROC macro definition. Replace the text within quotes in the following statement with the location of the %ROC macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the %ROC macro and make it available for use:
   %inc "<location of your file containing the ROC macro>";

Following this statement, you may call the %ROC macro. See the Results tab for examples.

You must first run the LOGISTIC procedure to fit each of the the models whose ROC curves are to be compared. Each model must be fit to exactly the same data set (with observations in the same order) and they must all be fit to the same response variable. The ROC macro requires that the response variable have only values of 0 and 1 even though this is not a restriction necessary for PROC LOGISTIC. Specify the EVENT="1" option in parentheses following the response variable name in the MODEL statement. Use the XBETA= or PRED= option in the OUTPUT statement in each run of LOGISTIC. The output data set names must be unique. Since the XBETA= or PRED= output variables are used to identify and compare the models' ROC curves, the names must be unique and it is recommended that you select a name for each variable that adequately identifies the fitted model.

The following macro parameters can be specified. The DATA, VAR=, and RESPONSE= parameters are required.

DATA=
Specify the names, separated by spaces, of the OUT= data sets from PROC LOGISTIC to be analyzed. Each data set should contain a variable created by the XBETA= or PRED= option. This parameter is required.
VAR=
The names of the XBETA= or PRED= variables, one from each data set. No name may occur more than once. Separate variable names in the list with spaces. This parameter is required.
RESPONSE=
The name of the response variable which has values of 0 or 1 only. This parameter is required.
CONTRAST=%str(hypothesis matrix)
Specifies the desired hypothesis matrix, L, for testing the null hypothesis L*R=0, where R is the vector or ROC curve areas and the ROC curve areas are assumed to be in the order given in the VAR= variable. The hypothesis matrix, L, must be surrounded by %str(). An L matrix with more than one row may be specified by using commas to separate the rows of coefficients. If omitted, a default contrast testing the equality of all ROC curve areas jointly and pairwise is used.
ALPHA=α
Specifies the level of significance α for 100(1-α)% confidence intervals. The value α must be between 0 and 1. The default value is 0.05 which results in 95% intervals.
DETAILS=YES | NO
Requests additional output. Default is no. Any other value will produce the additional output.

The version of the %ROC macro that you are using is displayed when you specify version (or any string) as the first argument. For example:

    %roc(version, data=a b, var=xba xbb, response=y)
DETAILS:
Details of the methodology are given in DeLong, et. al. (1988). The method is closely related to the jackknife. The method of components is described in chapter 3 of Puri and Sen (1971).

Note that ROC curves from models fit to two or more independent groups of observations are not dependent and therefore cannot be compared using these methods. The SEE ALSO section below refers to an appropriate method for comparing independent curves.

The ROC macro assigns a name to each table it creates. You can use these names to reference the table when using the Output Delivery System (ODS) to select or exclude tables and to create output data sets. The table names are listed in the following table along with any macro parameters required to make the table available. When outputting a table to a data set, you can determine the names of variables in the data set by using PROC CONTENTS.

ODS table name Description %ROC macro option
T Pairwise deletion Mann-Whitney Statistics DETAILS=yes
V Estimated Variance Matrix DETAILS=yes
NX X populations sample sizes DETAILS=yes
NY Y populations sample sizes DETAILS=yes
L Coefficients of Contrast default
LT Estimates of Contrast default
LV Variance Estimates of Contrast DETAILS=yes
AREASTAB ROC Area Std Error Confidence Limits default
DIFFSTAB Tests and 100(1-α)% Confidence Intervals for Contrast Rows default
CTEST Contrast Test Results default

In addition to displayable output, the ROC macro creates a macro variable, pvalue, containing the p-value from the test of joint equality of ROC curve areas.

Macro Updates

The %ROC macro attempts to check for a later version of itself. If it is unable to do this (such as if there is no active internet connection available), the macro will issue the following message:

   ROC: Unable to check for newer version

The computations performed by the macro are not affected by the appearance of this message.

LIMITATIONS:
The ROC macro cannot do BY-group processing and cannot handle output from PROC LOGISTIC which used BY-group processing. Limited error checking is done. Be sure that the data sets and variables exist and are correctly spelled. Only response values of 0 and 1 are allowed.
MISSING VALUES:
Pairwise deletion of missing values is used prior to computing Mann-Whitney components.
SEE ALSO:
The %ROCPLOT macro can plot an ROC curve with labelled points.

See this note on comparing the areas under independent ROC curves.

REFERENCES:
E.R. DeLong, D.M. DeLong, and D.L. Clarke-Pearson (1988), "Comparing the Areas Under Two or More Correlated Receiver Operating Characteristic Curves: A Nonparametric Approach," Biometrics, 44, 837-845.

Puri M.L and Sen P.K. (1971), Nonparametric Methods in Multivariate Analysis, Wiley.




These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.