1

I'm using a Cox model with 100k subjects and 1624 events to model the effects of a treatment with respect to 49 covariates, 127df.

Due to proportional hazard violation of some continuous variables, I've added restricted cubic splines using rcs(). Based on the p-values provided by cox.zph (which I've decided at 0.01 due to my sample size), the variables that previously violated the PH assumption no longer do.

However, it seems worth investigating this further instead of simply relying on the p-values in cox.zph. However, my understanding tells me that visualization of Schoenfeld plots after rcs() transformation has little value in doing this.

My questions thus are:

  1. How, then, would one investigate further if the PH assumption is truly satisfied after applying restricted cubic splines?

  2. Can this be visualized in a convenient way similar to how scaled Schoenfeld plots are used?

JED HK
  • 409

1 Answers1

2

The R survival package's cox.zph function has a "terms" option to combine all the terms relating to one predictor into one sub-linear predictor. Then you get an overall assessment of proportional hazards from the collapsed terms. It's difficult to plot what's going on but you can compute terms with predict(..., type='terms') and refit the model with the collapsed variables for purposes of getting smoothed scaled Schoenfeld residual plots. A related example may be found here. cox.zph also gives you multiple degree of freedom "chunk" tests of proportional hazards for all the spline terms without creating collapsed variables, as shown in an example there.

Frank Harrell
  • 91,879
  • 6
  • 178
  • 397
  • Your help is appreciated as always Professor Harrell. I've read parts of your book many times, I will look closely again at this part now. How reliable are the plots composed of these computed terms then? Additionally, if only certain of the portions of the variable after splining significantly violate the PH assumption (e.g., rcs(x)'' is significant but rcs(x)' and rcs(x) are not), how would you suggest tackling this? I don't recall having seen this described anywhere – JED HK Aug 23 '22 at 13:21
  • 1
    Don't look at individual components of splines. Look overall. – Frank Harrell Aug 23 '22 at 13:26
  • If I follow your advice and the link you send, some of my variables that previously had reasonable looking Schoenfeld curves with small error bars now change in magnitude and direction drastically, with much larger error bars (pvalues are comparable). I think this is suggestive of improperly specified functional form, although I can't imagine this being the case using rcs() (especially because most continuous variables were significantly nonlinear, according to pspline() and Poisson plots. Any thoughts here Professor Harrell? This should be the final piece of my analysis, help appreciated – JED HK Aug 23 '22 at 13:59
  • 1
    I very much doubt it's a functional form problem. The method of combining terms is more reliable and doesn't depend on how splines are constructed, so I'd trust it more. – Frank Harrell Aug 23 '22 at 18:44
  • That's very helpful Professor, thank you. So then finally: what to make of the Schoenfeld plots after using rcs() that very much suggest nonPH (and in some cases more so than before the addition of splines)? – JED HK Aug 23 '22 at 19:18
  • 1
    Couple the plots with the Z:PH test statistic and also take into account the scale of the plots. Sometimes the scale is exaggerated and the non-PH isn't as large as you initially think. – Frank Harrell Aug 23 '22 at 21:23
  • I tried using rho as you suggested in a previous post of mine but I must say values for rho don't seem to correlate well with the plots (i.e., some vars with larger rho values have small deviations on Schoenfeld). Besides, I think I should be consistent (i.e., if I use Schoenfeld to assess PH violation on my categorical vars I should do the same for my continuous, even if they've been splined). Thus de-exaggerating the scale sounds like a great solution (would also explain the apparent distortion after applying splines). How could one do this? You help is really appreciated Professor – JED HK Aug 24 '22 at 09:45
  • See if the plot method for cox.zph has a y-axis scale parameter and set all plots to use the same scale. If things are standardized (as with using terms) the scale might be -2 to +2. – Frank Harrell Aug 24 '22 at 11:21
  • If by "scale" parameter you mean ylim, it does have this and I've been using it to resize the plot to capture its shape properly (if the limits are too far out it appears flat, if the limits are too small the entire line cannot be seen). The magnitude between the vars varies greatly. – JED HK Aug 24 '22 at 13:55