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]
st: Survival analysis
From
"Westby, Christian Michael. (JSC-SK)[USRA]" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Survival analysis
Date
Fri, 29 Oct 2010 09:04:11 -0500
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 ties
No. of subjects = 8 Number of obs = 16
No. of failures = 13
Time at risk = 5607
Wald 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/