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]

From |
Steve Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: data prep for survival analysis with time varying covariate |

Date |
Sun, 22 Jan 2012 16:04:36 -0500 |

Dear Kyleigh, I find your description very confusing. You refer to an "event" and also to people who come off a waiting list to "receive services", which is something apparently different. Here's my attempt to decipher your problem 1. You are interested in events only after people come off the waiting list. 2. But you want the time dimension to be time after entry into the study, which is the time they go onto the waiting list. 3. Your question is then: for people who are off the waiting list and at time "t" have not yet had the event, will the amount of time spent on the waiting list influence the probability of having the event at that time. If I am correct, then events that occur while people are on the waiting list are not "censored", but they are to be ignored. Also, after people leave a waiting list, the time they were on it remains constant, so "waittime" is not a time-dependent variable. With this setup, you cannot estimate survival probabilities per se, but you can estimate the relative hazards of having events. If my guess about your question is right, then your current data setup is OK, and here is some sample code. I'm not sure why you think a "wide format" is needed, or even where you got the idea. There is nothing like it in the Stata Survival Manual entry for -stset-. ***************************************************************** stset timetoevent, id(id) failure(event==1) enter(time waittime) stcox waittime **************************************************************** But: I am not confident that this code responds to your "real problem". It is very dangerous to attempt an analysis when you don't understand basic issues. And when your question is confused, you are apt to get wrong advice. I'm going to quote Mike Hanson's instructions to his advanced econometrics class, given in a Statalist post of May 8, 2009: "Never push a button or type a command you do not fully understand.“ If you are a student at a university with a statistics program, I strongly suggest that you consult a faculty member who is expert in survival analysis. Also read a good text on the subject, such as An Introduction to Survival Analysis with Stata. The Stata manual contains many examples that might be helpful. . Finally, the proper spelling of the program we all use is "Stata", not "STATA". For the reason, see the last entry in the Statalist FAQ. Steve sjsamuels@gmail.com On Jan 18, 2012, at 6:19 PM, Kyleigh Schraeder wrote: 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/

**References**:**st: data prep for survival analysis with time varying covariate***From:*Kyleigh Schraeder <kyschraeder@gmail.com>

- Prev by Date:
**st: Calculating an Index** - Next by Date:
**Re: st: How to loop a <clean> script over multiple files?** - Previous by thread:
**st: R: data prep for survival analysis with time varying covariate** - Next by thread:
**Re: st: data prep for survival analysis with time varying covariate** - Index(es):