I would appreciate a sanity check of whether I am using Cox PH regression in R correctly to analyse recurrent events. First of all, I am sorry for the formatting of this question, ResearchGate is a terrible platform for posing difficult and complex question. I have posted this question up on Stackoverflow:

https://stats.stackexchange.com/questions/353692/modelling-recurrent-events-using-cox-regression-in-r

My work has used the instructions proposed in "Modelling recurrent events: a tutorial for analysis in epidemiology." Leila DAF Amorim and Jianwen Cai, International Journal of Epidemiology, 2015, 324-333.

I have implemented the PWP-GT (Prentice, Williams and Peterson-gap time) version of Cox PH regression to determine the risk of headache in a longitudinal cohort of headache suffers. My time-to-event is the next headache diagnosis within 365 days, otherwise there is no recurrent event, and then finally lost to follow up.

tstart - start of gap

tstop - end of gap

status - a recurrent event (0), a non-recurrent event (1) which can also mean lost-to-followup

event - the event count per subject

codetype - a covariate to indicate a general medical diagnosis from a doctor (m) from a referral diagnosis by a specialist (r).

id tstart tstop status event gender patientIMD codetype age

20001 0 4101 1 1 2 1 m 68

25001 0 91 0 1 2 1 m 44

25001 91 98 0 2 2 1 m 44

25001 98 159 0 3 2 1 r 44

25001 159 392 0 4 2 1 r 53

25001 392 1509 1 5 2 1 r 55

44001 0 7 0 1 2 1 m 44

44001 7 6041 1 2 2 1 r 61

45001 0 2622 1 1 2 1 m 66

106001 0 3288 1 1 2 1 m 51

119001 0 5737 1 1 2 1 m 56

129001 0 5911 1 1 2 1 m 75

146001 0 2348 1 1 1 1 m 51

159001 0 5897 1 1 2 1 m 45

173001 0 3938 1 1 2 1 m 58

202001 0 3015 1 1 2 2 m 53

207001 0 1383 1 1 2 2 m 24

228001 0 1693 1 1 1 1 m 29

292001 0 144 0 1 2 1 m 35

292001 144 194 0 2 2 1 m 37

292001 194 3173 1 3 2 1 r 52 .... ....

The code I am running is:

coxph(Surv(as.numeric(tstart),as.numeric(tstop),as.numeric(status))~ /

codetype+gender+age+patientIMD+ /

cluster(id)+strata(event),method="breslow", data=coxModel)

My question is quite a simple one, and probably reflects more on my relatively new understanding of recurrent survival analysis.

Notice how some of the patient records have a r entry in the codetype after switching from an m. This is when a patient has gone from a general doctor (m) to a referral/specialist (r). In theory, once a patient starts seeing a specialist their risk of the disease recurring with the previous frequency should drop. Is this something that would be captured in the Cox regression? Will recurrent Cox regression know how to handle a covariate switching value over-time in the same patient?

I also ask as I would like to see how patient disease frequency (risk) changes when a patient switches from drug A to drug B. I've seen this using recurrent survival curves, but only with a single covariate at a time.

More Anthony Nash's questions See All
Similar questions and discussions