The time used for evaluating an individual's survival in your Cox model is the time elapsed between study entry and the time of the event (or censoring). You can include in your model any predictor variable that might be associated with survival provided that it doesn't look into the future in some way. If the calendar date of study entry might be associated with survival time, then there's no problem including that as a predictor; the calendar date of study entry is known before any event is possible.
Therneau and Grambsch show models of the classic Stanford heart transplant data that include the calendar time of study entry as a predictor; see their models sfit.2
through sfit.6
in Section 3.7.1 (page 73). The predictor is called year
in those data, but it's a continuous variable expressed in units of years relative to 1 October 1967.
It's usually best to model continuous variables like age and calendar dates flexibly, for example with splines, to allow for other than linear associations with the log-hazard of an event. Here's a simple example based on the same underlying data, available in the R survival
package. I used the type of penalized splines built into that package, but you could also use natural regression splines as provided by the ns()
function in the splines
package, or the rcs()
function in the rms
package.
library(survival)
heartMod <- coxph(Surv(start,stop,event)~pspline(age)+pspline(year)+surgery, data=heart)
heartMod
# Call:
# coxph(formula = Surv(start, stop, event) ~ pspline(age) + pspline(year) +
surgery, data = heart)
#
# coef se(coef) se2 Chisq DF p
# pspline(age), linear 0.0270 0.0125 0.0123 4.6562 1.00 0.0309
# pspline(age), nonlin 5.9196 3.00 0.1158
# pspline(year), linear -0.1621 0.0700 0.0697 5.3677 1.00 0.0205
# pspline(year), nonlin 12.2151 2.99 0.0066
# surgery -0.8293 0.4041 0.3970 4.2125 1.00 0.0401
#
# Iterations: 5 outer, 15 Newton-Raphson
# Theta= 0.621
# Theta= 0.661
# Degrees of freedom for terms= 4 4 1
# Likelihood ratio test=34.6 on 8.96 df, p=7e-05
# n= 172, number of events= 75
In this case there's a significant nonlinear association of year
with outcome that wouldn't have been captured by using year
as a simple linear predictor. This model is probably a bit overfit, as modeling used up 9 degrees of freedom with only 75 events available, but it illustrates the way to proceed.
time = 0
study entry as a predictor in a survival model, even though the calendar dates go over a range of years while the event times aftertime = 0
in each case are only a few minutes. It sounds like that's all you would need to do. If you have something more complicated in mind, please edit the question to provide more details. $\endgroup$