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: RE: Cox model with a segmented time-dependent covariate
From
Kieran McCaul <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: RE: Cox model with a segmented time-dependent covariate
Date
Thu, 16 Jan 2014 06:32:55 +0800
...
Try this:
clear *
input patient time status treatment age lbr0 t1 lbr1 t2 lbr2
1 281 1 1 46 3.2 47 3.8 184 4.9
2 604 0 1 57 3.1 94 2.9 187 3.1
3 457 1 1 56 2.2 61 2.8 97 2.9
4 384 1 1 65 3.9 92 4.7 194 4.9
5 341 0 1 73 2.8 87 2.6 192 2.9
6 842 1 1 64 2.4 94 2.3 197 2.8
7 1514 1 0 69 2.4 74 2.9 202 3
8 182 0 0 62 2.4 90 2.5 182 2.9
9 1121 1 0 71 2.5 101 2.5 410 2.7
10 1411 0 0 69 2.3 182 2.2 847 2.8
11 814 1 0 77 3.8 167 3.9 498 4.3
12 1071 1 0 58 3.1 108 2.8 187 3.4
end
gen lbr = lbr0
stset time, f(status) id(patient)
stsplit one, at(1) after(time=t1)
stsplit two, at(1) after(time=t2)
replace lbr = lbr1 if one==1
replace lbr = lbr2 if two==1
list patient time status lbr0 lbr1 lbr2 lbr _st- _t0 , sepby(patient)
stcox lbr treatment age
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marta Garcia-Granero
Sent: Thursday, 16 January 2014 2:27 AM
To: [email protected]
Subject: st: Cox model with a segmented time-dependent covariate
I am trying to replicate some SPSS commands in Stata. This data were modified from David Collett (2003) Modelling Survival Data in Medical Research (Chapman & Hall/CRC Texts in Statistical Science), and show a hypothetical clinical trial on 12 patients. I want to test if treatment is significant, adjusted for age and ln(bilirrubin). Ln(bilirrubin) were measured 3 times: at baseline (lbr0); approximately at 3 months -with the exact day recorded in t1 (lbr1); and approximately at 6 months - with exact day recorded in t2 (lbr2).
+----------------------------------------------------------------------------+
| patient time status treatment age lbr0 t1 lbr1
t2 lbr2 |
|----------------------------------------------------------------------------|
1. | 1 281 Died Placebo 46 3.2 47 3.8
184 4.9 |
2. | 2 604 Alive Placebo 57 3.1 94 2.9
187 3.1 |
3. | 3 457 Died Placebo 56 2.2 61 2.8
97 2.9 |
4. | 4 384 Died Placebo 65 3.9 92 4.7
194 4.9 |
5. | 5 341 Alive Placebo 73 2.8 87 2.6
192 2.9 |
|----------------------------------------------------------------------------|
6. | 6 842 Died Placebo 64 2.4 94 2.3
197 2.8 |
7. | 7 1514 Died Treatment 69 2.4 74 2.9
202 3 |
8. | 8 182 Alive Treatment 62 2.4 90 2.5
182 2.9 |
9. | 9 1121 Died Treatment 71 2.5 101 2.5
410 2.7 |
10. | 10 1411 Alive Treatment 69 2.3 182 2.2
847 2.8 |
|----------------------------------------------------------------------------|
11. | 11 814 Died Treatment 77 3.8 167 3.9
498 4.3 |
12. | 12 1071 Died Treatment 58 3.1 108 2.8
187 3.4 |
+----------------------------------------------------------------------------+
With SPSS, I had to define a time varying covariate (T_COV_) and add it to the model:
TIME PROGRAM.
COMPUTE T_COV_ = (T_<t1)*lbr0 + (T_>=t1&T_<t2)*lbr1 + (T_>=t2)*lbr2.
COXREG time
/STATUS=status(1)
/CONTRAST (treatment)=Indicator
/METHOD=ENTER T_COV_ treatment age.
In SPSS, T_ is the same as Stata's _t.
This is the output:
coef se HR ----95%CI------
LR de sig
T_COV_ 4.533 2.488 93.05 0.71 12192.54 10.865 1
0.001
Treatment 4.749 2.860 115.50 0.42 31421.66 5.814 1
0.016
Age -0.078 0.094 0.93 0.77 1.11 0.808 1 0.369
With Stata, I suspect I have to use, somehow, -stsplit- and -stjoin- , but I can't figure how (even though I have used help stsplit, and read the whole PDF on stcox).
Any hints?
Thanks,
Marta Garcia-Granero
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/