# Goodness of fit – Testing Cox proportional hazard assumption in R

I am performing survival analysis on credit data. I created a simple model with using interest rate:
cox <- coxph(Surv(periods,charged_off) ~ int_rate, data=notes) I assumed that int_rate was a time-independent variable, but the following test rejects HA:

> cox.zph(cox)
rho chisq        p
int_rate 0.0446  14.2 0.000169


Same result for other variables such as loan amount:

> cox <- coxph(Surv(periods,charged_off) ~ int_rate + loan_amnt, data=notes)
> cox.zph(cox)
rho chisq        p
int_rate  0.0364  9.31 2.28e-03
loan_amnt 0.0317  8.84 2.95e-03
GLOBAL        NA 26.28 1.97e-06


Plot for int_rate:

Why would these covariates be considered time dependent? Am I doing something wrong? Thanks.

• Although this question does not seem to call for a R solution, it remains good practice to flag that you are using R. Jan 20 '14 at 15:46
• Thanks for your attention, but I was suggesting flagging, not tagging. Look again at the R tag to see that the tag is needed only if the solution is to be R-based. Your question seems statistical. Jan 20 '14 at 15:59
• How large is your dataset? I notice the coefficient between transformed survival time and the scaled residuals, rho, is small. Jan 20 '14 at 16:14
• I have over 240,000 observations. Jan 20 '14 at 16:26
• Graphically, you can see that there is a time-dependence (if there was none, your graph would be constant). That said, note that you should not overestimate the relevance of the $p$-value you get from cox.zph. This test is very sensitive, and will reject independence very quickly, even if that has little practical impact. Yes, your coefficients are significantly time-dependent, but so what? The $p$-value doesn't answer the real question, being how big a mistake you are making by treating the coefficient as time-independent (i.e., the effect size), or whether or not it matters at all. Oct 15 '15 at 14:05

For further information on how the authors of the survival package use cox.zph, I recommend Chapter 6:"Testing Proportional Hazards" in their book, "Modeling Survival Data". Your result resembles their illustration of the time dependence of the Karnofsky performance measure. They consider various options for using a transformed time scale.