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: R: data prep for survival analysis with time varying covariate
From
<[email protected]>
To
<[email protected]>
Subject
st: R: data prep for survival analysis with time varying covariate
Date
Sat, 21 Jan 2012 12:50:03 +0100
Dear Kyleigh,
I have expanded a bit the chuck of dataset you provided the list with (10
patients, one failure each during the analysis time; patients are gathered
in two different groups (drugs, with a 0/1 dummy)), as in its original
version was impossible to analyze (too few observations). Two Cox
regressions were performed, considering either variable Waittime constant
over time (-stcox drugs Waittime-), or variable Waittime varying with time
(interacting with a square root function of analysis time: -stcox drugs,
tvc(Waittime) texp((_t)^.5)-).
It's up to you to verify whether these assumptions (cox regression and tvc,
namely) fit your research issue.
HTH and Kind Regards,
Carlo
...............................code
starts.......................................
input ID Timetoevent Event Waittime
1 50 0 40
2 73 0 8
3 150 1 100
4 100 0 50
5 70 0 10
6 35 0 60
7 120 1 80
8 20 1 0
9 140 0 100
10 200 1 30
end
stset Timetoevent, id(ID) failure(Event==1)
g drugs=1 in 1/5
replace drugs=0 if drugs==.
stcox drugs Waittime
stcox drugs, tvc(Waittime) texp((_t)^.5)
............................code
ends.................................................
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Kyleigh Schraeder
Inviato: giovedì 19 gennaio 2012 00:20
A: [email protected]
Oggetto: st: data prep for survival analysis with time varying covariate
Hi Dr. Gagnon,
This is the first time I'm using a survival analysis so I hope my questions
make sense.
My variables are: id, timetoevent (in days), event, and waittime.
In my study, every patient has their own start time or time 0. At time 0,
each patient is put on a wait-list. Some patients may still be waiting when
the 'event' happens (they should be censored).
However, some patients may come off of the wait list and receive services.
Thus, some patients are technically 'not waiting' for a period of time
before the event occurs. So, as I understand, 'waittime' is a time-varying
covariate.
I am interested in examining the effect of a patient's wait-time on the
outcome (whether the event occurs). In other words, what is the probability
of the event occuring for patient X, given their waiting time. Right now my
data is currently set up where each participant has their own row of data.
ID Timetoevent Event Waittime
1 50 0 40
2 73 0 8
3 150 1 100
I'm not sure how to best arrange the data in STATA since I'm confused as to
how to put this data in the wide-person format since I don't have an Event1,
Event2, Event3 or a Wait1 Wait2 Wait3.. I have tried creating a vector
using loop commands (to give me an Event1 Event2
Event3) but I need to specify the number of variables I create (max
390 days of observation) and this is different for each patient..
Any help or steps in the right direction would be appreciated! Thank you
Kyleigh
*
* 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/