Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Adjusting Predicted probabilities in SAS Base

Reply
Frequent Contributor
Posts: 126

Adjusting Predicted probabilities in SAS Base

Hi all,

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

Trusted Advisor
Posts: 1,204

Re: Adjusting Predicted probabilities in SAS Base

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.

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

Exactly that's what I did, would you happen to have any example on the offset option syntax wise so i could understand it better?

Thanks

Trusted Advisor
Posts: 1,204

Re: Adjusting Predicted probabilities in SAS Base

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

Thnx

Super Contributor
Posts: 336

Re: Adjusting Predicted probabilities in SAS Base

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!

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

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?

Trusted Advisor
Posts: 1,204

Re: Adjusting Predicted probabilities in SAS Base

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.

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

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?

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

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

Trusted Advisor
Posts: 1,204

Re: Adjusting Predicted probabilities in SAS Base

That is correct. If the objective is to see significance of predictors only then you don't need to use offset.

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

Thank you for your clarifications

Frequent Contributor
Posts: 126

Re: Adjusting Predicted probabilities in SAS Base

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_));

        run;

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

     OUTROC=ROC

    OUT=SCORESPOP PREDICTED=ESTPROB

;

RUN;

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

Ask a Question
Discussion stats
  • 12 replies
  • 707 views
  • 0 likes
  • 3 in conversation