I am performing a PWP (conditional) recurrent cox regression analysis over medical records. For each individual, events are indicated by dates in their medical record. It is, therefore very easy to generate the correct data structure for gap-time in R. The units are in days, and the tstart and tstop structure follows the same layout as Anderson-Gill Cox.

It is my understanding that any formulation of a Cox model (recurrent or otherwise, PWP, AG, etc) is to estimate the effect of covariates on the baseline hazard function, and that the baseline hazard function is consistent across time after being obtained from the start when all covariates are set to zero.

In my model, I have a few constant covariates e.g., gender, and time-dependent covariates e.g., age. I can structure the data and layout the model accordingly.

However this is the difficult part: I would like the baseline hazard ratio to be recalculated for every event. I have a probability function that calculates the probability of remission given the number of days between events i.e., the gap-time in the cox model. The outcome of this probability function per event should have an effect on the baseline hazard ratio.

Unfortunately, I have no idea how to do this! Many thanks


1 Answer 1


As i understand it strata in the survival package will let you fit separate baseline hazards for the levels of the object being stratified. So, in this case, if you have a column recording how many events there are, then strata(numberofevents) will fit a new baseline hazard between each event.

There is actually a model called PWP-Gap Time which does calculate only time since previous event and thus assumes a separate baseline hazard for each 'chunk' of time.

Prentice RL, Williams BJ, Peterson AV: On the regression analysis of multivariate failure time data. Biometrika 68: 373–379, 1981

Assuming you've cut your data up into chunks of time between events, your model's code might look something like this:

   model<- coxph(Surv(tstart,tstop,status)~IVs+strata(numberofevents)+ cluster(id),data=df)
  • $\begingroup$ Thanks for your comment. Since your post, I've spent a lot of time looking into PWP-Gap Time and I believe it's what I want. However, I would like to now make a modification to how the baseline hazard is calculated per gap-time. For example, I have a probability of remission function that takes as input the gap-time duration. How can I make this probability of remission impact on the outcome from the cox model? Thus, not only does the baseline hazard reset at each new event but it is also affected by how long the gap-time is. Thanks. $\endgroup$ Jan 5, 2019 at 0:05
  • $\begingroup$ @AnthonyNash well adding in any new covariate will change the baseline hazard. Just like in regression adding in a new IV will change the value of the intercept. However, i worry about what you're saying because how can you use the gap time to affect the model? gap time is the dependent variable already. $\endgroup$
    – Huy Pham
    Jan 6, 2019 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.