Date: Wed, 17 Aug 2011 17:15:22 -0700
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: Why did my Proc Lifereg predicted all zero survival
probabilities
In-Reply-To: <CAJuWB0nRH1YGNczw1qY9ZM+anc9hfut-OjXD8uE4ATveY1xNwA@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Chung Y. Li
> Sent: Wednesday, August 17, 2011 4:48 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Why did my Proc Lifereg predicted all zero survival
> probabilities
>
> 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
> ;
Susie,
Without a reproducible example, it is kind of hard to play along. But, the first thing I would look at is the value of _dist_ in your estimator dataset. Is it ever equal to "EXPONENT" OR _DIST_="WEIBULL" (all caps, exact spelling)?
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|