# Interpreting Schoenfeld Residuals Trend vs P-Value

Edit: added new plots generated with plot.cox.zph(), to replace those I had generated with survminer::ggcoxzph(), due to an error in the code of the latter as pointed out by EdM in a comment.

Recently I've been learning about Survival Analysis, and today I'm practicing checking the proportional hazards assumption of a Cox PH regression.

I've read that plotting the Schoenfeld residuals of a certain predictor is a way of assessing the validity of the proportional hazards assumption for that predictor. As I understand it, if the trend line through those residuals is not flat then it suggests the proportional hazards assumption is not valid for that predictor.

But having just done this for two predictors in my Cox PH regression, I am perplexed by the fact that the covariate with the wigglier trend through its Schoenfeld residuals is associated with a much higher p-value than that of the covariate with the less wiggly trend:

The trend in the upper plot is associated with a p-value of 0.887, while that of the lower plot is 0.076.

My question is: why does the wigglier Schoenfeld residual trend have a much higher associated p-value in this case? I assume my being perplexed by this has to do with some lack of understanding of the concepts at play.

• You seem to be using the survminer package or some derivative package that has a SERIOUS CODING ERROR in its Schoenfeld residual plotting. See this page for how to proceed. Please replace your plots with plots done correctly as explained on the linked page, as in their current form they are essentially uninterpretable.
– EdM
Commented Jul 19, 2022 at 16:40
• @EdM thanks for pointing this out. I've edited the post to have the plots generated by plot.cox.zph(), as you suggest in your answer to that other question. I'm still confused as to why the wigglier trend has a much higher p-value in this case. Can you offer any insights based on the new plots?
– lex
Commented Jul 20, 2022 at 15:06
• @lex I just asked something somewhat similar (stats.stackexchange.com/questions/582606/…). It seems the resources for this are unclear Commented Jul 20, 2022 at 15:17

The null hypothesis evaluated by cox.zph() is whether the slope of the scaled Schoenfeld residuals versus (transformed) time equals 0. A wiggly curve without an overall trend is hard to distinguish from a straight flat line on that basis, so the result is a very high probability (p-value) that your data for the upper, wiggly curve are consistent with that null hypothesis.
The second curve has a fairly consistent upward trend with time. That makes it much less likely that the null hypothesis of slope = 0 is true. The p-value is "close to significant" by the usual, arbitrary, p < 0.05 criterion.
In the top plot it looks like there is a noticeable drop in the coefficient estimate right after the very first time (time = 1?), perhaps from positive to negative, a rise thereafter until about time = 60, and fairly flat thereafter. Does that make sense, based on your understanding of the subject matter? Modeling that predictor with a time-varying coefficient could be considered. See the time-dependence vignette of the R survival package.