BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
danirecchia
Calcite | Level 5

Hello everyone,

I have one dataset and I want to model the probability of default from a loan. I used the logistic regression for it but with the data in different structures. I do use the same (original) data, but one model I used the row data and for another model I used the categorized data (I built all the categories) and now I want to be able to compare the two models in order to say if the structure of the data has some influence on the results.

I tought I could maybe compare their misclassification rate, but how could I build such a test to make this comparison, since here I have only one value (the misclassification rate) for each model?

Do you have some idea?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Doc_Duke
Rhodochrosite | Level 12

Rick, I guess I am dating myself....

Dan, Rick's example will work for your situation as long as the dependent variable (LoanDefault, say) is the same.  Just specify multiple predictor variables in the ROC statement.

ods graphics on;

proc logistic data=_last_ plots=roc(id=prob);

  CLASS d e f;

  model LoanDefault = a b c d e f / nofit;

  roc 'Model1' a b c;

  roc 'Model2' d e f;

  roccontrast reference('Model1') / estimate e;

run;

ods graphics off;

View solution in original post

7 REPLIES 7
Doc_Duke
Rhodochrosite | Level 12

One measure of quality of a logistic regression is the ROC curve (often summarized by the c-index).  This article provides a general method for comparing two ROC curves that were derived from the same underlying data.

Rick_SAS
SAS Super FREQ

You don't need the macro anymore. This is now built into PROC LOGISTIC via the ROCCONTRAST statement: http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_logistic_sec...

danirecchia
Calcite | Level 5

Hello Rick,

as I saw in the example that you sent, the ROCCONTRAST compares the ROC Curves from different the 3 different models with the 3 variables. But you see, for me originally the data is the same, but to adjust the model with categorized data I had to do some modifications and I can't see how should I use this option to compare the curves, since not only the data (structural - variables in classes) but also the chosen variables, I would like to compare both final models from row - and categorized data.

Doc_Duke
Rhodochrosite | Level 12

Rick, I guess I am dating myself....

Dan, Rick's example will work for your situation as long as the dependent variable (LoanDefault, say) is the same.  Just specify multiple predictor variables in the ROC statement.

ods graphics on;

proc logistic data=_last_ plots=roc(id=prob);

  CLASS d e f;

  model LoanDefault = a b c d e f / nofit;

  roc 'Model1' a b c;

  roc 'Model2' d e f;

  roccontrast reference('Model1') / estimate e;

run;

ods graphics off;

danirecchia
Calcite | Level 5

Hello Doc@Duke,

thank you very much for the explanation! I see now, what should I do. Smiley Happy

tarek03
Calcite | Level 5

The fastest and easiest way is to compare the c-stat values between the 2 models.  c-stat ranges between 0.5 and 1.  The higher the c-stat, the better the performance and accuracy of the model.  And PROC LOGISTIC returns c-stat. c-stat is nothing but the area between the 45 degree line and the curve, which is the ROC.

danirecchia
Calcite | Level 5

Hey tarek03,

yep, the c-statistic is a very used measure and I tought on this comparison but you see, if I just look for the values of the c-statistic I am not able to compare them. But now, whith the ROCCONTRAST I know what to do.

But I also think that a very interesting test would be the one, which I could compare the misclassification rate from the models, maybe this could be more specific on the discrimination power of the model. But for this case I don't know yet what to do.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 11469 views
  • 4 likes
  • 4 in conversation