Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Predicting survival at some specific times


From   Edgar Munoz <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Predicting survival at some specific times
Date   Sun, 7 Aug 2011 00:48:50 -0500

After stcox you can also use survci to obtain pointwise confidence intervals for the covariate-adjusted survivor fn or cum hazard fn

Edgar Munoz
Statistician
IHPR @ UTHSCSA



On Aug 6, 2011, at 10:22 PM, Steven Samuels <[email protected]> wrote:

> On Aug 5, 2011, at 12:06 PM, [email protected] wrote:
> 
>> Hello,
>> I would appreciate if someone could kindly let me know how to predict survival (probability) at some specific times for
>> each subject after using streg and stcox commands.  For instance, how can I predict 2-year survival after using streg
>> (stcox) on a group patients with breast cancer?
> 
> 
> Here is code inspired by Bobby Gutierrez's post at http://www.stata.com/statalist/archive/2010-12/msg00647.html. The -stcox- prediction assumes that you have observations at the time you want to predict for. To create and name predictions for several times, you'll need to use -foreach- loops.
> 
> Steve
> 
> *************CODE BEGINS*************
> /* streg  with prediction at t = 20 */
> scalar tt = 20
> sysuse cancer, clear
> gen id =_n
> streg age, dist(weibull)
> gen t_old = _t
> replace _t=tt
> predict s1, surv
> label var s1 "streg prediction"
> replace _t = t_old
> 
> /* stcox, assumes an observation at t= 20! */
> 
> stcox age
> predict xb, xb
> predict s, basesurv
> gen stt = s if t==tt
> sum stt, meanonly
> replace stt = r(mean)
> gen s2 = stt^exp(xb)
> label var s2 "stcox prediction"
> sort age
> di "Survival computed at t = " tt
> list age id  s1 s2
> **************CODE ENDS**************
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index