Quantcast
Viewing all articles
Browse latest Browse all 425

SAS : Calculating KS Test

In predictive modeling, it is very important to check whether the model is able to distinguish between events and non-events. There is a performance statistics called "Kolmogorov-Smirnov" (KS) statistics which measures the discriminatory power of a model.

Kolmogorov-Smirnov (KS) Statistics
It looks at maximum difference between distribution of cumulative events and cumulative non-events.
SAS Code : Calculating KS Statistics 
data full;
do i=1 to 1000;
x=rannor(12342);
p=1/(1+exp(-(-3.35+2*x)));
y2=ranbin(98435,1,p);
drop i;
output;
end;
run;
proc logistic data= full;
model y2(event="1")=x;
output out=out2 p= pred;
run;
Proc npar1way data=out2 edf;
class y2;
var pred;
run;
Image may be NSFW.
Clik here to view.
KS Output 

Viewing all articles
Browse latest Browse all 425