I will try to keep my question as short as possible.
For my thesis I am researching if a risk score can predict graft failure in a cohort of $596$ patients over the course of $10$ years. (The variable is not time-varying)
I want to do a Cox regression, however the Shoenfeld residuals test is significant ($0.038$). Which means that the proportional hazard assumption has been violated.
I have tried to solve this by adding an interaction term with the log of time as shown below:
.stcox t_risk10_perc risk10_perc
t_risk10_perc = log(time variable of follow-up) * risk10_perc
My questions are:
- Am I doing this correctly?
- Should I look at the
t_risk10_perc
or at therisk10_perc
hazard ratio?
Best Answer
Unless the syntax of your software differs substantially from that of the
coxph
function in the Rsurvival
package, then your approach is not correct. You are, however, in very extensive company in trying to fix a proportional-hazard issue this way. A simple modification can correctly accomplish what you desire, at least withcoxph
.As I understand your code, your definition
simply multiplies, for each case, the value of the covariate
risk10_perc
by the survival/censoring time for that case. As the vignette on "Using Time Dependent Covariates" in the Rsurvival
package puts it:As explained in the vignette, the
survival
package allows for a time-transform functionality, with which you can define an arbitrary function of continuous time (not just of the single observed event/censoring time) and covariate values to accomplish this type of analysis. This will provide estimates of coefficient values both for the covariate and for your function of time, both of which you will need to interpret appropriately. You will have to check your software to see if it provides a similar time-transform functionality.