# Calculating area under curve (AUC) from Predicted Probability

This article explains a way you can calculate AUC from predicted probability column in a validation dataset.

proc logistic data=train;
model y(event="1") = entry;
score data=valid out=valpred;
run;

ods select none;
ods output WilcoxonScores=WilcoxonScore;
proc npar1way wilcoxon data= valpred ;
where y^=.;
class y;
var  p_1;
run;
ods select all;

data AUC;
set WilcoxonScore end=eof;
retain v1 v2 1;
if _n_=1 then v1=abs(ExpectedSum - SumOfScores);
v2=N*v2;
if eof then do;
d=v1/v2;
Gini=d * 2;    AUC=d+0.5;
put AUC=  GINI=;
keep AUC Gini;
output;
end;
run; Related Posts
About Author: Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 8 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Telecom and Human Resource.

1 Response to "Calculating area under curve (AUC) from Predicted Probability"
1. I thought this already gets calculated by SAS and its included in the ROC chart?

Next → ← Prev
Love this Post? Spread the Word!
Share