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]

From |
rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Survival analysis - individual survival functions |

Date |
Thu, 16 Dec 2010 15:45:40 -0600 |

Paul Seed <paul.seed@kcl.ac.uk> asks: > Following a parametric survival regression, I can use -predict- with the > -surv- option to get the survival function; but I only do not seem to have > any choice over when it is calculated for. > The help file promises me values for S(t|t_0), and I would like to set both > t and t_0 myself. But they seem to be set automatically, at the time of > entry and exit of the subject. > Is there a simple way of doing this? If not, is there any chance of it > being included in a future version of Stata? Paul has received some good advice on alternatives to doing this directly, but doing it directly is possible by manipulating the variables that -predict- uses to calculate S(t|t_0). Of course, when you do this you have to be careful to put everything back in place when you are done. To illustrate, we fit a Weibull model on the cancer data that ships with Stata, and we use one covariate, -age- . sysuse cancer, clear . streg age, dist(weibull) The time variables that -predict- uses to predict the survival function are stored in variables _t and _t0, as established by -stset-. We proceed by making back up versions of these variables. We'll also back up -age- since we want to set this at a fixed value for the predictions, too. . gen age_old = age . gen t_old = _t . gen t0_old = _t0 Once backed up, we are free to manipulate these. We begin by resetting _t to an evenly-spaced grid from 0 to 20 . drop _t . range _t 0 20 Then we replace _t0 to be zero everywhere (it probably already is as this is a simple dataset, but we do it anyway), and we set -age- to be 75 so that the corresponding survival prediction is for someone aged 75 . replace _t0 = 0 . replace age = 75 We can now predict S(t|_t0) for -age == 75- and at the time values as manually set: . predict s, surv . list _t0 _t s Of course, remember to put everything back in place . replace age = age_old . replace _t = t_old . replace _t0 = t0_old --Bobby rgutierrez@stata.com * * 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: RE: Survival analysis - individual survival functions***From:*Steven Samuels <sjsamuels@gmail.com>

- Prev by Date:
**RE: st: margins vs. lincom** - Next by Date:
**st: xtnbreg** - Previous by thread:
**Re: st: RE: Survival analysis - individual survival functions** - Next by thread:
**Re: st: RE: Survival analysis - individual survival functions** - Index(es):