I am currently working on a survival analysis project and am struggling regarding the inner workings of the coxph
function of the survival
package in R.
The project investigates the influence of a numeric measure on employee tenure lengths. The measure is calculated for every calendar week. To do this, I am using coxph
. More precisely, the version for time-varying covariates:
out <- coxph(formula = Surv(tstart, tstop, turnover) ~ score, data = mydata)
Essentially, the survival analysis should check the recent history of scores and not just the value of the current week. However, I am unsure whether this is already part of standard procedure of coxph
or whether I need to adjust the score values myself (e.g. via a rolling total over the last X weeks). Unfortunately, sources seem to disagree about this aspect.
In the answer to this question, it seems past values of the time-varying covariate are automatically included.
In other words, the hazard at time t depends on the probability of the event to happen at time t, given that it has not happened so far (T≥t) and given the past (H(t_)). This past includes information up to time t.
In contrast, the authors of this vignette state the opposite:
The model tries to assign a risk score to each subject that best predicts the outcome of each drawing based on [...] The covariate values of each subject just prior to the event time.
I would be grateful for some clarification regarding this aspect of the Cox proportional hazards model in R as it determines how I need to prepare my data and interpret the output.