LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 17 Aug 2011 19:47:44 -0400
Reply-To:     "Chung Y. Li" <li.chungying@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Chung Y. Li" <li.chungying@GMAIL.COM>
Subject:      Why did my Proc Lifereg predicted all zero survival probabilities
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I am building a customer attrition model using PROC LIFEREG, then a prediction macro to predict the survival probabilities of the customers in the validation dataset at each time. I ended up getting all zeros predicted probabilities, even at time=0 (see below). Could you help me to find out what is wrong with my code?

Susie C Y Li

proc lifereg data=append outest=estimator; class state managed; model time*censor(0)= age Asset product / dist=weibull; output out=predicted_S xbeta=lp control=use; title "Attrition model using LIFEREG"; run;

*Use the predict macro to score each customer's survival probability in the validation dataset (use=1);

%macro predict(outest=,out=_last_,xbeta=,time=); Data _pred_; _p_=1; set &outest (keep=_dist_ _scale_ ) point=_p_; set &out; lp=&xbeta; t=&time; gamma=1/_scale_; alpha=exp(-lp*gamma); prob=0; if _dist_="EXPONENT" OR _DIST_="WEIBULL" then prob=exp(-alpha*t**gamma); drop lp gamma alpha _dist_ _scale_; run; %mend predict;

%predict(outest=estimator,out=predicted_S,xbeta=lp,time=0);

* output dataset _pred_:

ID time censor age H_asset product Managed State use _PROB_ t prob

100353 18 0 81 060962 3 0 CA 1 0.5 0 0 100359 18 0 82 113017 5 0 CA 1 0.5 0 0 121235 3 1 88 092768 3 0 CA 1 0.5 0 0 125147 9 1 91 395 2 0 CA 1 0.5 0 0 ;


Back to: Top of message | Previous page | Main SAS-L page