05-06-2014 09:21 AM
I have the following situation, I have created a training and validation sample in which both the analogy of events/nonevents is the same thus 50-50.
I have fitted the training sample and tested my model on the validation sample (using proc logistic) with good results and i want to score now the initial population as a final test from which i made the two samples.
The initial population consists of 80% nonevents (0) and 20% events (1), if am not mistaken this means that i will have to adjust my predicted probabilities on the population to the true event rate since my model was build on a 50-50 analogy is that correct?
How could i do that in SAS Base? I mean which output from the logistic regression must I investigate and apply this alteration? Any ideas? If i could know how the predicted probability in the first case is calculated maybe i could adjust within that calculation.
Thank you in advance
05-06-2014 09:43 AM
I think you oversampled the population to make event/non-event in 50-50 proportions in your training/validation samples. Check offset option in logistic regression to adjust predicted probabilities.
05-06-2014 11:10 AM
Thanks @stat@sas !
An awesome read... I stopped doing what I was doing just to read this even if I don't use base SAS (I use EM). Still, very nice article... Thanks!
05-06-2014 11:33 AM
One more question though, by using either prior or offset will i be adjusting the probabilities in the population data that i want to score or the already predicted probabilities in the training and validation set?
05-06-2014 12:40 PM
Offset just aligns intercept it does not effect beta coefficients. Use offset in proc logistic using your training data set and get the parameter estimates. Score validation dataset using estimates obtained through training dataset. If you see results are almost similar then you can use this model for population dataset as well.
05-06-2014 12:46 PM
Ok , I was just under the impression that since the intercept gets "inflated" that would mean that the predicted probabilities would get inflated too ,thus they would need adjustment too, am I wrong?
05-06-2014 12:49 PM
Aha ok i misread since i am adjusting intercept I am good to go, so for scoring the validation which is also of a 50-50 analogy i dont need to adjust, that would be only for the population scoring where the true rates of events and non events is depicted
05-07-2014 03:35 AM
I have tried the following :
proc freq data=OUTPUT.POPULATION (THE SET WITH 95% nonevents and 5% events) noprint;
table TARGET / out=priors(drop=percent rename=(count=_prior_));
and i try to score it with the parameters based on the training set:
PROC LOGISTIC INMODEL=MODELPARAMETERSTRAINING (the 50-50 sample) ;
SCORE DATA=OUTPUT.POPULATION PRIOR=PRIORS
Would that be the correct syntax? I am wondering cause when i compare the estimated probabilities of scoring with or without the priors i see a huge difference in p_1