Currently I am analyzing factors associated with a certain adverse event (A) in patients who are treated with drug (B). The data is from a longitudinal observational cohort (10 years of follow-up, patients were assessed annually, 11 assessments per patient in total). The data is sorted by patient ID and time (in years, range 0-10). The data is shaped long: each assessment is a single observation (row) in the database (so for 100 patients I have 1100 observations).
Some patients used drug B from the start of follow-up, while others started using this drug at a later time, so the moment they become at risk can vary on an indiviual level. In some patients the event of interest can occur multiple times over follow-up, so I want to do a cox regression for recurrent events to take into account all events.
Variables:
I have come to the following code to set my data as survival data, using the Stata manual:
I have 2 questions regarding this analysis:
1. Would this be the correct code to set up the data as survival data for a recurrent event analysis (inspecting the data and the survival variables (_st _t _t0 _d) I think it is).
2. And a second question: based on the nature of my event of interest, I would think that the risk of this event occurring is higher when patients already had this event before. Once I identified my 'id' variable (like I did in the stset command above), does Stata take this into account? For example: if I have a patient with 1 event and another patient with 3 events over time, does Stata treat this as 4 totally different events (as if 4 patients all had 1 event, with ofcourse different time-to-event), or does it take into account that 3 events actually occurred in 1 patient and are possibly correlated? Does the 'cluster' option when doing the cox regression help with this (cluster patients by ID, using cluster(ID))?
Thanks in advance!
Some patients used drug B from the start of follow-up, while others started using this drug at a later time, so the moment they become at risk can vary on an indiviual level. In some patients the event of interest can occur multiple times over follow-up, so I want to do a cox regression for recurrent events to take into account all events.
Variables:
Code:
'ID' = patient ID 'time' = time in years of follow-up 'drug_b' = using drug B (scored 1/0) 'event_a' = adverse event of interest (scored 1/0) 'event_b' = other events, such as death (scored 1/0) (I want to censor patients from the moment event_b occurs)
Code:
stset time, id(ID) failure(event_a==1) enter(time==0) origin(drug_b==1) exit(event_b==1 time .)
1. Would this be the correct code to set up the data as survival data for a recurrent event analysis (inspecting the data and the survival variables (_st _t _t0 _d) I think it is).
2. And a second question: based on the nature of my event of interest, I would think that the risk of this event occurring is higher when patients already had this event before. Once I identified my 'id' variable (like I did in the stset command above), does Stata take this into account? For example: if I have a patient with 1 event and another patient with 3 events over time, does Stata treat this as 4 totally different events (as if 4 patients all had 1 event, with ofcourse different time-to-event), or does it take into account that 3 events actually occurred in 1 patient and are possibly correlated? Does the 'cluster' option when doing the cox regression help with this (cluster patients by ID, using cluster(ID))?
Thanks in advance!
Comment