Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Steven Samuels <sjsamuels@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Survival analysis question |
Date | Wed, 3 Nov 2010 13:35:29 -0400 |
Chris Westby:You don't have multiple-failure data, because the start time for the two tests should be zero. The correct statement is:
stset t, failure(fail)This will change the -stcox- results as well. Also try -stsum, by(treatment)- after the two versions of -stset--. I suggest that you consider the -shared- option in -stcox- to allow for the possibility of person-specific baseline hazards. Note that eight subjects is probably not enough for the standard errors to be reliable.
Steve Steven J. Samuels sjsamuels@gmail.com 18 Cantine's Island Saugerties NY 12477 USA Voice: 845-246-0774 Fax: 206-202-4783On Nov 3, 2010, at 8:35 AM, Westby, Christian Michael. (JSC-SK)[USRA] wrote:
Dear Statalisters,I am working on comparing survival times in one group of subjects before and after treatment and am having a hard time with the "stset" code.
Using the following data set where testing was separated by 1 week, t is time of task before and after treatment (seconds) and ttrxt is time calculated to prevent time from being treated as continuous and fail is 0=completed, 1=not completed.
subjectid treatment fail t ttrxt ----------------------------------------------------------------- 1 pre failed 169 169 1 post failed 141 310 2 pre failed 114 114 2 post failed 84 198 3 pre failed 564 564 3 post failed 296 860 4 pre failed 168 168 4 post failed 332 500 5 pre failed 215 215 5 post failed 50 265 6 pre completed 900 900 6 post failed 196 1096 7 pre completed 900 900 7 post failed 298 1198 8 pre completed 900 900 8 post failed 280 1180 ----------------------------------------------------------------- I used . stset ttrxt, id(subjectid) failure(fail) exit(time .) id: subjectid failure event: fail != 0 & fail < . obs. time interval: (ttrxt[_n-1], ttrxt] exit on or before: time . ------------------------------------------------------------------------------ 16 total obs. 0 exclusions ------------------------------------------------------------------------------ 16 obs. remaining, representing 8 subjects 13 failures in multiple failure-per-subject data 5607 total analysis time at risk, at risk from t = 0 earliest observed entry t = 0 last observed exit t = 1198 I then ran . stcox treatment, cluster(subjectid) failure _d: fail analysis time _t: ttrxt exit on or before: time . id: subjectid Iteration 0: log pseudolikelihood = -20.175132 Iteration 1: log pseudolikelihood = -18.079165 Iteration 2: log pseudolikelihood = -18.026011 Iteration 3: log pseudolikelihood = -18.025935 Refining estimates: Iteration 0: log pseudolikelihood = -18.025935 Cox regression -- no tiesNo. of subjects = 8 Number of obs = 16
No. of failures = 13 Time at risk = 5607Wald chi2(1) = 4.22 Log pseudolikelihood = -18.025935 Prob > chi2 = 0.0399
(Std. Err. adjusted for 8 clusters in subjectid)
------------------------------------------------------------------------------ | Robust_t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+---------------------------------------------------------- -------------+------treatment | 4.610013 3.428317 2.05 0.040 1.073226 19.80218
------------------------------------------------------------------------------I believe that the output and results are accurate however, I am unable to get Stata to correctly graph the survival curves using the following code
. stcurv, surv at1(treatment=0) at2(treatment=1)the resulting graph incorrectly plots both groups starting at less than 100% at a time=0 and the x-axis scale is incorrect.
Any thoughts? Chris * * 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/