Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Steve Samuels <sjsamuels@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: How to estimate adjusted survival curves after fitting Cox model |
Date | Thu, 3 Jun 2010 13:34:02 -0400 |
I'm not sure what you mean by "adjusted". The following code will produce predicted survival curves for different combinations of covariates, if you have a Stata with -margins- and factor variables try this. (FAQ: always state the Version of Stata you are using). With older versions, -adjust- will work after -xi: stcox-. Steve -- Steven Samuels sjsamuels@gmail.com 18 Cantine's Island Saugerties NY 12477 USA Voice: 845-246-0774 Fax: 206-202-4783 *************CODE BEGINS************ webuse drugtr,clear stdes set seed 18720 gen v2 = uniform()<.5 quietly stcox i.v2 i.drug c.age, basesurv(prsurv) ** By hand predict new, xb sum new if age ==50 & drug==1 & v2==0 sum new if age==60 & drug==1 & v2==1 ** Using -margins: check against the -sum new- results margins v2#drug , at(age =(50,60)) predict(xb) matrix ests =r(b) matrix list ests local cc =colsof(ests) forvalues i = 1/`cc'{ gen prsurv_`i' =prsurv^exp(el(ests,1,`i')) } sum pr* ******************CODE ENDS*************** On Wed, Jun 2, 2010 at 11:09 PM, Sanam P <sanamp25@yahoo.com> wrote: > Thank you Maarten for your response > > I have been able to estimate the adjusted survivals at individual level using below codes using Professor Yi Li notes at Department of Biostatistics, Harvard SPH: > > http://biowww.dfci.harvard.edu/~yili/lect5notes.pdf > > > **baseline survivals: > xi:stcox i.var1 i.var2 i.var3 var4, basesurv(prsurv) > > predict betaz, xb > > gen newterm=exp(betaz) > > gen predsurv=prsurv^newterm > > However I dont know what should do next to get the adjusted survivals for combinations of the covariates and not at individual level. > > Regards, > Sadaf > > > > > ----- Original Message ---- > From: Maarten buis <maartenbuis@yahoo.co.uk> > To: stata list <statalist@hsphsun2.harvard.edu> > Sent: Wed, June 2, 2010 5:47:03 PM > Subject: Fw: st: How to estimate adjusted survival curves after fitting Cox model > > --- On Wed, 2/6/10, Sanam P wrote: >> I was wondering what is the best way for >> calculating adjusted survival curves after fitting a cox >> regression model in stata. >> >> I think in the Kaplan miere method using "sts graph" and >> "adjust for " the calculated adjusted curves are for when >> all the coefficients are equal to zero which is not be the >> best method. > > I am guessing that you are looking for something similar to > an average marginal effect: i.e. a survival curve that averages > over the distribution of the explanatory variables. However, > what is the the distribution of the explanatory variable in a > survival analysis? The distribution at t=0, or at each individual > time point. In some sense the latter seems more attractive, but > notice that changes in the survival curve then also represent > changes in the distribution of the explanatory variables in the > at risk population. However, the whole point why we add controll > variables is that we want to keep them constant... > > The trouble is that you are dealing with non-linear models, so > looking for a single "best way" is usually not fruitful. You are > much better of by considering the different summary statistics > possible and find out what it is they say and understand and report > why they give different results. > > Hope this helps, > Maarten > > -------------------------- > Maarten L. Buis > Institut fuer Soziologie > Universitaet Tuebingen > Wilhelmstrasse 36 > 72074 Tuebingen > Germany > > http://www.maartenbuis.nl > -------------------------- > > > > > * > * 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/