# Checking cox.zph in R after time transformation of covariates

I have a model created by the coxph function and I checked the proportionality of hazards using cox.zph function.

coxph(formula = Surv(OS, OSCheck) ~ Age + Sex + Gradeofhistology +
RTCT + PathologicalTstage + PathologicalNstage + Residualtumor +
data = dataset.IMP.1)

n= 1798, number of events= 428

coef exp(coef)  se(coef)      z Pr(>|z|)
Age                                                      0.016781  1.016923  0.004548  3.690 0.000224
Sex                                                      0.218564  1.244289  0.100215  2.181 0.029186
Gradeofhistology                                         0.483098  1.621089  0.105719  4.570 4.89e-06
RTCT                                                    -0.309947  0.733485  0.111247 -2.786 0.005334
PathologicalTstage                                       0.424244  1.528435  0.126524  3.353 0.000799
PathologicalNstage                                       0.626894  1.871787  0.067099  9.343  < 2e-16
Residualtumor                                            0.655163  1.925455  0.088111  7.436 1.04e-13
ChemotherapyCyclesadjuvant                              -0.054194  0.947248  0.015549 -3.485 0.000492
RTunexpectedinterruption                                 0.016878  1.017021  0.005063  3.333 0.000858
---

Concordance= 0.719  (se = 0.015 )
Rsquare= 0.127   (max possible= 0.964 )
Likelihood ratio test= 244.6  on 9 df,   p=0
Wald test            = 279.2  on 9 df,   p=0
Score (logrank) test = 319.5  on 9 df,   p=0


Three of the nine significant covariates in the output seem not to follow the proportionality assumption

                                                        rho   chisq        p
Age                                                      0.0122  0.0684 7.94e-01
Sex                                                      0.0618  1.6171 2.03e-01
Gradeofhistology                                        -0.1836 14.7069 1.26e-04
RTCT                                                    -0.0197  0.1723 6.78e-01
PathologicalTstage                                       0.0205  0.1847 6.67e-01
PathologicalNstage                                      -0.1006  4.4607 3.47e-02
Residualtumor                                           -0.0669  1.9260 1.65e-01
ChemotherapyCyclesadjuvant                               0.1314  7.5641 5.95e-03
RTunexpectedinterruptiondaysduetomedicalreasonspostoper -0.0199  0.2091 6.48e-01
GLOBAL

NA 34.9298 6.13e-05


like this one in the picture It seems that this covariate (like the others not following the PH assumption) affects the value of coefficient above all in the first 2 years of follow-up and thereafter the value becomes less important. I have created another model using a time transformation but I would like to test the PH assumptions for the time transformed covariates. cox.zph doesn't seem to go (it gives an error) for the evaluation of time transformed covariates Cox PH model. How can I do it?

Please elaborate on "using a time transformation". There are no simple transformations of the predictors that will satisfy the PH assumption, and transforming the event times will have no impact; you would have to add time-dependent covariates, greatly complicating the model. If there is only one or two variables that are strongly non-PH you could stratify rather than model them as covariates. There are two downsides to this: you lose precision in estimating $S(t|X)$ and you lose the ability to make easy statistical inference about the stratification factors.
If all non-PH is of the same form as the plot you provided, and choosing a different model does not make other predictors actually fit worse, then you can consider an accelerated failure time model. AFT models force the hazard ratio to converge to 1.0 as $t \rightarrow \infty$. Examples include the log-normal and log-logistic models. The Weibull PH model is an AFT model but assumes PH, so it won't help you here.
• I created a model with a function for creating time dependent covariates using the following code: coxph(formula = Surv(OS, OSCheck) ~ Age + Sex + RTCT + PathologicalTstage + Residualtumor + RTunexpectedinterruptiondaysduetomedicalreasonspostoper + tt(PathologicalNstage) + tt(Gradeofhistology) + tt(ChemotherapyCyclesadjuvant), data = dataset.IMP.1, tt = function(x, t, ...) (x/t)) I used a transformation of covariates for the inverse of time. I'd like to check, using something like cox.zph if this assumption is correct. – Nicola Dinapoli Dec 9 '13 at 15:05
• You did not read my note, which described the two reasons why the above strategy is not appropriate. Note that to have time-dependent covariates in coxph you need to provide "start time, stop time" to Surv and to have multiple records per subject. – Frank Harrell Dec 10 '13 at 12:41
• I understand that but you can't compute functions of time and call that a proper time-dependent covariate in a Cox model. Time-dep. covariates change the likelihood function. You are still effectively using static covariates since you are not following the instructions for proper use of coxph with the start, stop notation. And dividing a covariate by absolute time is a strange way to incorporate non-constant covariate effects. – Frank Harrell Dec 11 '13 at 22:16