Solved – Interpretation of interaction between covariates and time in cox regression

cox-modelrsurvivaltime-varying-covariate

If I have a categorial variable (let's say $X$) and a continuos variable (let's say $Y$). IF I fitted a standard cox model, it will result in a violation of the constant HR over time (based of Schoenfeld residuals). So, I fitted again with interaction (with time). In R, this can be written as
$$Surv(start,stop,event) = X + Y + X:stop + Y:stop$$

And, the interaction time is significant for both variables. My question is, how to correctly interpret this ? Is it correct to say that the hazard ratio of $X$ and $Y$ is increasing (or decreasing) with time ? Since the interaction is significant…

Best Answer

Setting up time-interactions

First you need to split your dataset in order to do the time interaction. Then you set the start-time as the interaction term as that is independent of the outcome.

Decreasing/increasing

Yes, it is either decreasing or increasing with time although note that you also need to take into account the raw variable. There are two basic situations:

  • If $\beta_X < 0$ and $\beta_{X:stop} < 0$ or $\beta_X > 0$ and $\beta_{X:stop} > 0$ then the difference increases over time.
  • If $\beta_X > 0$ and $\beta_{X:stop} < 0$ or $\beta_X < 0$ and $\beta_{X:stop} > 0$ then the difference is diminishing until the time point $\beta_X = Time*\beta_{X:stop}$ where the risks start to differ.

An important issue is that you are all the time assuming linearity with this construction. You should also check if there is a non-linear relationship for the time interaction. I use this together with the contrast function in the rms package in order to visualize this effect. I