In setting up my data for survival analysis, I have already created spell data, including a variable "begin", which will serve as t
0 and "end" which will serve as t
1 ('begin' and 'end' ==1 if true or == 0 otherwise). "end" can also be used to identify "failure". As I am looking at the length of relationships (for different groups) and have multiple years of panel data, I set exti(time .) to allow for multiple 'failures' per id (failure = end of a relationship).
After reading Mario Cleves "How do I stset my spell-type data?"
https://www.stata.com/support/faqs/s...ell-type-data/ and the early chapters in "An Introduction to Survival Analysis Using Stata", I arrived at:
Code:
stset wave, id(id) origin(wave==1) failure(end==1) enter(begin==1) exit(time .)
Not sure if I needed to, but I tried to include "time0(wave==1)", but Stata reported it invalid to use "==".
FYI. I am using Stata 15.1.
0 Response to stset data for survival analysis
Post a Comment