# Time-dependent covariate in extended Cox model

In Cox's PHM,

$$\lambda(t;\mathbb{x}) = \lambda_0(t) \exp(\beta^T \mathbb{x})~,$$ it is well known that the effect of a time - independent covariate on the survivor function is to raise it to a power given by the relative risk.

I'd like to know what the effect on the survivor function would be if we consider instead a time dependent covariate.

Thanks.

First, let us consider the time-independent case, given by the hazard

$\lambda(t) = \lambda_0(t)\exp(\beta^Tx)$.

The survivor function, $S$, can be found as

$S(t) = \exp(-\Lambda(t))$,

where

$\Lambda(t) = \int_0^t \lambda(s)\text{ d}s$.

As the covariates are constant over time, we get that

\begin{align} S(t) & = \exp(-\int_0^t \lambda(s)\text{ d}s) = \exp(-\int_0^t \lambda_0(s)\exp(\beta^Tx)\text{ d}s) \\ & = \left(\exp(-\int_0^t \lambda_0(s)\text{ d}s)\right)^{\exp(\beta^Tx)}. \end{align}

From this we see that the "baseline" $S$ (all covariates equal to 0) is lifted to a power given by the coefficients and the covariates. The ratio of these powers for two combinations of covariates is exactly the hazard ratio. We can now do exactly the same for a time-dependent set of covariates, $x(t)$. We get that

\begin{align} S(t) & = \exp(-\int_0^t \lambda_0(s)\exp(\beta^Tx(s))\text{ d}s). \end{align}

But now what to do? If we do not impose any assumptions on $x(t)$, we'll have a hard time getting anywhere. We can still estimate the parameters of the model, using some piece of statistical software, however, right now we're looking for a theoretical understanding of the way time-dependent covariates influence the survivor function. So let's assume that we have only one time-dependent covariate and that it is piece-wise constant. Furthermore, for simplicity, we can assume that it only takes on two different values for the subject we consider. The assumptions of only one time-dependent covariate and the last assumption can be generalized easily, whereas the assumption of piece-wise constant covariates is the important one: we need to be able to work with the integral without knowing anything about $\lambda_0$.

We assume that $x(t)$ is constant on $(0,t_1]$ and on $(t_1, \infty)$. By simply splitting into disjoint intervals we see that

\begin{align} S(t) = \left(\exp(-\int_0^{t_1} \lambda_0(s)\text{ d}s)\right)^{\exp(\beta^Tx_1)} \left(\exp(-\int_{t_1}^t \lambda_0(s) \text{ d}s)\right)^{\exp(\beta^Tx_2)}, \end{align}

where $t>t_1$.

Maybe not surprisingly, we see that it splits as a product of two survivor functions from the constant case (over disjoint time-intervals). This corresponds exactly to the way piece-wise constant covariates are most often handled. If for instance we do repeated measurements of some kind during follow-up, we might want to update the covariates of a subject. This gives rise to piece-wise constant covariates. We can handle this in the Cox model by splitting the subject into multiple subjects with constant covariates. These constructed subjects are then observed on disjoint time intervals.

• That's a great answer, do you have any references about the handling of piecewise constant you mentioned? I'm especially looking into doing a Python implementation. – pygabriel Apr 21 '15 at 20:54
• Terry Therneau and Patricia Grambsch (Modeling Survival Data: Extending the Cox Model, 2010) write about time-dependent covariates in the Cox model (pp.69-70). They also explain that implementing a model with a piecewise constant covariate simply involves "splitting" inviduals into sub-individuals that are constant in the covariates. It should be fairly easy to implement the "splitting" in Python, but I don't know if it has already been done. – swmo Apr 22 '15 at 8:18