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:
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
(??, 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
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
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.