Solved – Survival analysis in time series

analysissurvivaltime series

I have a dataset of patients who're prescribed a medication over the period of 3 years. The drug was supplied to each patient in different time intervals. I want to do a survival analysis to monitor recurrent events (i.e., events occurring multiple times).

The problem with the data is that, for some patients, the events do not occur in those time intervals where the drug is prescribed (e.g., an event may occur before/after the drug supply period). If I don't adjust this problem, using conventional survival analysis methods like Cox proportional hazard model may under/over-estimate the risk of events happening (because an event can happen when the drug supply is 0). So, how can I resolve this issue?

Best Answer

This might be handled by standard recurrent-event analysis allowing for time-dependent covariates (in this case, in particular whether the drug was being provided during each time interval). The general principles and illustrations for analysis in SAS, Stata and R are nicely presented in a recent paper by Amorim and Cai.

In R, the simplest approach would be to format the data with columns for (patientID, startTime, stopTime, event, drugStatus, otherCovariateValues...) with a separate row starting with each change of drug (or of other time-dependent covariates) or ending with each event. See this vignette for ways to format data this way. Including an ID for each patient allows correction for the correlations of results within individuals, e.g. by including a term of cluster(patientID) as a predictor in the model. This approach would be appropriate if the occurrence of an event is simply a function of the covariates and drug status at the time of the event, and if subsequent recurrent events were independent of prior events (given the present values of drug/covariates).

There isn't a problem here with events happening absent the drug. Presumably your interest is in whether the drug affects the probability/timing of an event occurring, and this analysis would address this issue directly provided that the above assumptions hold.

It is possible to model more complicated situations in which prior events themselves influence the probability of subsequent events, cumulative exposure to drug rather than instantaneous exposure is related to events, and so on. The references linked above are useful starting points for exploring these possibilities.