# Can Cox models be used with time-varying covariates?

I work at a hard drive manufacturer. In my project, we have huge sets of testing data of hard drives. Most of them are time-varying covariates.

My colleges are using cox regression. I doubt it.

These testing parameters (covariates) are time-varying. They don't know how to interpret the coefficients estimated.

1. Can they use Cox / survival for these time-varying covariates?

2. If yes, how do we interpret the coefficients of these time-varying covariates?

3. Can we use joint modeling of survival and longitudinal data for it?

4. If not, what do you guys think is the best way to extract information from testing data and relate it to survival analysis?

5. Do you know any good resource for researches like this?

• Are you testing how long the HDs last before they fail? If so, Cox models seem reasonable. Time varying covariates are more advanced, but very doable w/ Cox models. What are the covariates you're looking at? Could you paste in some sample output you want help interpreting? – gung Mar 23 '15 at 3:12

First of - Yes, an extended Cox model can handle time dependent covariates (and coefficients) with ease, and with no change to the underlying model. Mind you that the data set needs to reflect this time dependency. For example:

subject time1 time2 event  var1  var2
1      0     15    0     25    1.3
1     15     46    0     25    1.5
1     46     73    0     25    1.4
1     73    100    1     25    1.6


var2 is a time dependent covariate.

coxph(Surv(time1, time2, event) ~ var1 + var2, data = data)

coef exp(coef) se(coef)    z  p
var1  -1.072  0.342     0.262  -3.44  0.00058
var2  -0.0574 0.944     0.022  -2.61  0.009


So in this made up example, var2 can be said that holding var1 constant each additional unit of var2 reduces the weekly hazard ratio by 5.6% on average.

The interpretation seems similar to non-time varying covariates, yet there is an underlying difference - that is that the time is taken into account. In a dummy variable that is time dependent it is simpler to understand - The time while the variable is not existent (0) is taken into account when calculating the effect on the hazard ratio.

You can see Using Time Dependent Covariates and Time Dependent Coefficients in the Cox Model by Therneau (creator of the survival package) for further explanations.

• Thanks. BTW can coxph function do predictions of Survival Curve as well? I thought proportional method needs an estimate of the underlying survival curve to do so. – John Oct 10 '16 at 1:32
• This is less my forte, but generally speaking Cox is not a predictive model, it just gives the hazard ratio change per covariate. but look link here for some know how on how to do it. – Yuval Spiegler Oct 13 '16 at 16:38