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: RE: Predicting survival at a specific time following generalized gamma regression


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Predicting survival at a specific time following generalized gamma regression
Date   Wed, 11 Jul 2012 10:57:25 -0400

Al's advice to transform S(t) is excellent. My previous example
produced confidence limits outside of [0,1] Here's a rewrite e with 
the complementary log-log transformation. c(t) = log(-log(S(t)).

Steve
sjsamuels@gmail.com

*****************************************
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 c_`myt' =
cloglog(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(lowc_`myt' uppc_`myt');
#delim cr
gen surv_`myt' = 1- invcloglog(c_`myt')
gen s_low_`myt' =1- invcloglog(uppc_`myt')
gen s_upp_`myt' =1 -invcloglog(lowc_`myt')
sum  t_surv surv_* s_low* s_upp*
list  t_surv surv_* s_low* s_upp* in 1/2
*************************************

On Jul 11, 2012, at 9:32 AM, Feiveson, Alan H. (JSC-SK311) wrote:

Thomas - If you look up the expression for the survival function S(t) for the generalized gamma (in the manual under -streg-) you can see that S(t) is a complicated function of "Xb" - the (linear predictor) for a particular value of time, the covariates, and the ancillary parameters kappa and sigma. You can use -nlcom- or -nlpredict- to get confidence limits for this function. Better, because S(t) is bounded between 0 and 1, you can get confidence limits for logit(S(t)) or probit(S(t)), which covers all values, then transform back to guarantee that your limits will lie between 0 and 1.

I know this is messy. Perhaps there are more direct ways of doing this. We need something like -margins- to work for predicting survival after running -streg-.

Al Feiveson

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Thomas Inns
Sent: Wednesday, July 11, 2012 6:25 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Predicting survival at a specific time following generalized gamma regression

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/


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