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 |
Steve Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Predicting survival at a specific time following generalized gamma regression |

Date |
Wed, 11 Jul 2012 10:01:25 -0400 |

Thomas: Here's an example. You don't need to use Bobby's fake data trick, but I use it for comparison. Note that in writing to Statalist, the FAQ suggest that you illustrate your problem with a data set available to all. ***************************************** webuse drugtr, clear streg drug age, dist(gamma) time coeflegend gen old_t = _t replace _t = 20 predict t_surv, surv local myt = 20 #delim ; predictnl surv_`myt' = 1- gammap( _b[kappa:_cons]^(-2), (_b[kappa:_cons]^(-2))*exp(_b[kappa:_cons]* (log(`myt')-xb())/exp(_b[ln_sig:_cons]))), se(se_`myt') ci(low_`myt' upp_`myt'); #delim cr sum t_surv surv_* se* low* upp* ********************************************* You should be able to use the -predictnl- statement without change if you define local myt = 365.25 Using a local variable will also allow you to use a loop over multiple times. In my example I used the fact that estimated kappa >0. If kappa<0, replace "1-gammap" with "gammap". Steve sjsamuels@gmail.com On Jul 11, 2012, at 7:24 AM, Thomas Inns wrote: Hello, If someone could kindly take the time to help me I'd be very appreciative. I'm try to predict the probability of survival at one year following infection. I'm using a parametric survival model with a generalized gamma distribution and an accelerated failure-time metric (streg, distribution(gamma) time). I have used the streg postestimation command "predict, surv", but I can't work out how to put a confidence interval around my predicted survival probability at one year following infection. Is this possible? And if so, do you know how I might do this? Below is my code, inspired by Bobby Gutierrez's post at http://www.stata.com/statalist/archive/2010-12/msg00647.html. Thanks, Thomas Inns *************CODE BEGINS************* streg i.ribolog i.gender i.agetri i.year i.ftbin##i.trustapp, d(gamma) time ****predict conditional survivor function (probability of survival past time t) ****(time t = 1 year) *prediction at t = 365.25 gen tt = 365.25 *keep old _t gen t_old = _t *put in _t you want to use for prediction replace _t = tt *predict surival past time _t (one year) predict t_surv, surv label var t_surv "gamma prediction" *summarise these predictions summ t_surv, detail **************CODE ENDS************** ************************************************************************** The information contained in the EMail and any attachments is confidential and intended solely and for the attention and use of the named addressee(s). It may not be disclosed to any other person without the express authority of the HPA, or the intended recipient, or both. If you are not the intended recipient, you must not disclose, copy, distribute or retain this message or any part of it. This footnote also confirms that this EMail has been swept for computer viruses by Symantec.Cloud, but please re-sweep any attachments before opening or saving. HTTP://www.HPA.org.uk ************************************************************************** * * 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/

**References**:**st: Predicting survival at a specific time following generalized gamma regression***From:*Thomas Inns <Thomas.Inns@hpa.org.uk>

- Prev by Date:
**RE: st: Predicting survival at a specific time following generalized gamma regression** - Next by Date:
**st: export results of adjust command** - Previous by thread:
**RE: st: Predicting survival at a specific time following generalized gamma regression** - Next by thread:
**st: Lag variables - generate missing values** - Index(es):