Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Edgar Munoz <munozedg@hotmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

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 <sjsamuels@gmail.com> wrote: > On Aug 5, 2011, at 12:06 PM, nakhtardanesh@cogeco.ca 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/

**Follow-Ups**:**Re: st: Predicting survival at some specific times***From:*Edgar Munoz <munozedg@hotmail.com>

**References**:**st: Predicting survival at some specific times***From:*nakhtardanesh@cogeco.ca

**Re: st: Predicting survival at some specific times***From:*Steven Samuels <sjsamuels@gmail.com>

- Prev by Date:
**Re: st: semi-random sampling** - Next by Date:
**Re: st: Predicting survival at some specific times** - Previous by thread:
**Re: st: Predicting survival at some specific times** - Next by thread:
**Re: st: Predicting survival at some specific times** - Index(es):