2
$\begingroup$

The dataset I am working with is of this form:

id  status futime age trt trt0
 1       1    708  65   0    1
 2       0    111  64   0    1
 3       0   3046  69   0    0
 4       1    478  52   0    0
 5       1    636  62   0    0
 6       1    128  64   0    0

This data was collected for 690 patients. The event of interest is death, with status == 1 when a patient died during the observation period. The column futime correspond to the duration between baseline and the event of interest (or censoring). The covariate age corresponds to the age at baseline (in years). The covariate trt is a binary variable which indicates if a patient received a treatment at baseline. It may happen that some patient were already hospitalized before baseline. If so, they might have received different treatments before baseline. The covariate trt0 is a binary variable which indicates whether a patient received treatments before baseline.

Here is a naive Cox model I tried:

fit <- coxph(Surv(futime, status) ~ age + trt + trt0, data = data)

I wondered if the PH (proportional hazards) hypothesis holds for this data and tested for it:

cox.zph(fit)

with the following result:

       chisq df     p
age     1.14  1 0.286
trt     5.47  1 0.019
trt0    2.51  1 0.113
GLOBAL  9.04  3 0.029

The way I understand these results, the PH hypothesis is violated by the trt covariate. I read that a possible workaround would be to do a Cox model with time-dependent covariates. However, if a patient received treatments before baseline, I do not know when.

To fit a Cox model with time-dependent covariates, I would need to transform my dataset to the (tstart, tstop) format. If my understanding is correct, for the first patient (id == 1), the transformed data would look like this:

id  status tstart tstop trt
 1       0     ??     0   1
 1       1      0   708   1

Here, (??, 0) would be the time interval (pre-baseline) in which the patient received his treatments (the ones given before baseline). However ?? is unknown. How can I deal with this issue? Is there a workaround which does not involves having to define these (tstart, tstop) intervals and considering trt as a time-varying covariate?

POST ANSWER EDIT: Following EdM's answer, I'm adding a graph of the scaled Schoenfeld residuals for the trt covariate:

enter image description here

There seems to be a negative effect of treatment with time. Splitting at time=380 seems to do the job:

df.new <- survSplit(Surv(futime, status) ~ ., data = df2, cut=c(380), episode ="timegroup")
fit.new <- coxph(Surv(tstart, futime, status) ~ age + trt0 + trt * strata(timegroup), data = df.new)

And the result of cox.zph for fit.new is:

                      chisq df    p
age                    1.14  1 0.29
trt0                   2.43  1 0.12
trt                    1.64  1 0.20
trt:strata(timegroup)  1.70  1 0.19
GLOBAL                 5.32  4 0.26

We can see that no covariate violates the PH hypothesis anymore.

$\endgroup$
2
$\begingroup$

The PH problem comes from the primary variable of interest, trt, and that isn't a time-varying variable. Either the treatment was given at study start or it wasn't. Playing with the prior-treatment indicator trt0 probably won't help with PH, either.

It's possible that some survival-related covariates that you're not including in your model is leading to the PH problem. It's also possible, however, that the effect of trt is fundamentally time-varying in a way that precludes PH in a simple model.

You need instead to consider a time-varying coefficient for trt if you wish to pursue a Cox model. Look at the plot of scaled Schoenfeld residuals versus time to get an idea of what's going on. Sometimes you can find a dividing point in time that provides two epochs, with PH within each epoch but different hazard ratios for the two epochs. Or you might need to specify some continuous function of time for the coefficient, for example with the tt() functionality provided by the R survival package. Instructions for handling time-varying coefficients are in the time-dependent vignette for the survival package.

You might also be in a situation that is better handled by an accelerated failure time model, without PH, than by a model that assumes PH. One example is a log-normal model. The survreg() function in the survival package allows for such models, and many more implementations are linked from the CRAN survival task view.

$\endgroup$
2
  • $\begingroup$ Thank you for the nice answer! I updated my post with the plot of the scaled residuals and what I believe to be a solution for the trt covariate. Still, one point remains unclear for me: is there a better way of adding info about previous treatments in a Cox model? I considered the trt0 indicator since I do not have a lower bound on the time at which those treatments were administered. Could I do better than that? $\endgroup$ – Pouteri Feb 2 at 15:41
  • $\begingroup$ @Pouteri I don't see a better way to handle prior other treatments. If all that you know is that someone received some other treatment some time before the time origin for the study, then an indicator seems OK. If the specific trt of interest was received before entry into your study, however, then things are trickier. In that case you have only a lower limit to the time between the start of trt and death, so the survival time is right censored. But that individual wasn't even available for observation of death until your study started, a situation properly handled by left truncation. $\endgroup$ – EdM Feb 2 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.