Bookmark and Share

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]

Re: st: Predicting survival at some specific times


From   Steven Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Predicting survival at some specific times
Date   Sun, 7 Aug 2011 07:27:25 -0400

As the FAQ request, please indicate the source of non-official commands.  Unfortunately -survci- (-findit-) doesn't save individual predictions, which was the original request.

Steve



On Aug 7, 2011, at 1:55 AM, Edgar Munoz wrote:

... you have to use the outfile option to save the plot data to a .dta file

On Aug 7, 2011, at 12:48 AM, Edgar Munoz <munozedg@hotmail.com> wrote:

> 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/
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index