I am working on a survival analysis in R using the survival package (and trying to switch it to a Bayesian analysis but that may be a different question). Either way, I'd eventually like to incorporate time-varying covariates, so I'm trying to set the data up as a counting process. But, I'm getting a little lost in "time".

I have a set of wildlife telemetry data where we relocated individuals approximately once per month, though the day of the month varies. I've seen examples in the literature where a monthly relocation schedule means they are alive on the first, and stay alive through the month, and if they die that month, it is assigned to the last day of the month. So, I have my start and stop times set up according to months. For example:

      id enter  exit event  year
   <dbl> <dbl> <dbl> <dbl> <dbl>
 1     1     2     9     0  2012
 2     1     0     8     0  2013
 3     1    11    12     0  2013
 4     1     0     1     0  2014
 5     2     2     7     0  2012
 6     3     2     9     0  2012
 7     3     0    12     0  2013

where 11=November, 12=December, etc., and the first row indicates we relocated that animal ever month starting in March, but then lost it for a few months after hearing it in September.

The timescale is also set up to be recurrent, so I've split individuals into rows according to year.

Just as a starting point, I ran a Cox PH model on these data:

fit_1 <- coxph(Surv(enter, exit, event) ~ 1, data=dat)

And the survival estimates by the end of the year are much lower than published estimates. So, I'm wondering if my data aren't set up correctly.

In the survival vignette for the counting process, the start and stop times are in days.

subject  time1   time2 death creatinine
1    5       0      90     0        0.9
2    5      90     120     0        1.5
3    5     120     185     1        1.2

So, my questions are:

  1. Does it matter that I've set my data up according to months? Or do I need to somehow put these times into days? (E.g., should the first row have enter=60 and exit=274 to account for those months in days? But that seems wrong since we only relocated the animal for 1 day during a month.)
  2. Am I getting low survival estimates because I'm using the counting process format without time-varying covariates? I've run the same dataset through survfit(Surv(exit, event) ~ 1, dat=dat) and coxph(Surv(exit, event) ~ 1, data=dat), which give similar results to each other, but are different than what is produced from Surv(enter, exit, event).

1 Answer 1


There is no need to define the time scale in terms of days versus months. A Cox model, like you used, doesn't even take actual time values into account, just the ordering of events in time.

With a limited number of possible time points it might make sense to treat this as a discrete-time survival model instead. That's analyzed as a set of binomial regressions, one for each time interval for all those at risk during the interval. That can accommodate time-varying covariates by specifying the covariate values in place for each at-risk individual during each interval.

If you are modeling death as the outcome, no more than one event is possible per individual. In that case you don't have "recurrent events" in the way that terminology is used in event modeling, with multiple events possible per individual.

I don't see that it makes sense to re-set the time=0 reference to the beginning of each year for each individual, as your current counting-process data format implies. That presumably explains the different results for analyzing data in that format with enter,exit,event, versus your 2 models that omit the enter time values. That might also explain the difference between your model results and those you expected from the literature. If you are going to use the counting-process data format to handle time-varying covariates in a Cox model, then you have to specify an appropriate time=0 reference.

I suspect that re-setting of time=0 each year for each individual contributes to the disagreement between your results with the counting-process format and what you expected from the literature, but it's hard to know for sure without more details.


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.