4

I would like to check hazard proportional assumption in a large coxph. Usually I check it with cox.zph but with large coxph my p-values are very small whereas the $\log\left(-\log(S(t)\right)$ curves are almost parallel (so the assumption is verified).

I have to validate my model by bootstrap validation (an optimism-corrected estimate of performance). For this purpose, I made a loop with some steps including one that checks the assumption! So I need something like the cox.zph procedure (I can't check 200*number of covariables plot). I tried this kind of thing :

coxph(Surv(time, state) ~ X1*(log(time)) ) 

But It doesn't work, the p-values are significant! I heard about Lasso method but I know nothing about this ...

Anyone have an idea ?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467

2 Answers2

1

The log(-log(S)) plot is almost useless; departures from proportional hazards need to be very strong to be reliably visible.

The interaction with log(time) doesn't do what you probably think it does. The variable time is fixed for an individual; it's the time at which they fail or are censored. What you probably want is an interaction where the time variable at any instant is the time at that instant.

The easiest way to just get these tests in R is with the cox.zph function. It does score tests for constant $\beta$ vs time-varying $\beta$, and there's a plot method so you can see how each $\beta$ varies over time. If you then want to model a time-varying effect there's a vignette for the survival package that gives ways to do it

However, if what you want is to look at predictive accuracy, you should look at predictive accuracy rather than testing proportional hazards.

Thomas Lumley
  • 21,784
  • 1
  • 22
  • 73
0

As with normality testing, a large data set can show a "statistically significant" departure from proportional hazards (PH) in a Cox model that isn't large enough to make a practical difference. That's discussed, for example, on this page.

If graphs based on the model built on the entire data set show adequate consistency with the PH assumption, you shouldn't have to test PH during your bootstrap validation. The PH part of your model is OK. Validation is important for evaluating optimistic overfitting, but repeated testing of PH on all of the bootstrap-based models isn't needed. For example, repeated PH testing isn't part of the bootstrap validation and calibration provided by the rms package in R.

Finally, your method for testing PH has a fundamental flaw: using the event/censoring time itself as a predictor in a Cox model. If you want to incorporate a time dependence in your model you need to use a more general function of time elapsed since time = 0 as the predictor. Otherwise you generate survivorship bias: the probability of survival estimated by the model depends on the duration of survival. That common error and the correct way to proceed are discussed in Section 4.2 of the time-dependent vignette of the R survival package.

EdM
  • 57,766
  • 7
  • 66
  • 187