It would seem to be wise to incorporate weights into proportional hazard (PH) tests as you are incorporating them into the Cox model itself. You presumably don't want a case that was down-weighted in the Cox regression to have disproportionate influence on a PH test.
Section 3.5 of "The Survival Package" vignette for the R survival package (now at version 3.2-3) discusses tests of the PH assumption. It notes that the cox.zph()
function now uses a score test to examine PH rather than the approximation with a correlation test that was used in versions prior to 3.0 (and that you will probably see when you look at most on-line discussions of that function, as this change happened in late 2019; there is no longer a "rho" value reported).
The code for this new version of cox.zph()
(available by typing cox.zph
at the R command prompt) shows that it now looks for and incorporates case weights into its calculations, taking them from the coxph
object.*
The weighting is done via C code that you can inspect by downloading the source code for the package. I haven't worked through the details myself, however.
Note that with large data sets or multiple covariates you might find a violation of PH that nevertheless doesn't substantially affect the fundamental results. See this answer for discussion about implications of lack of PH for Cox model power, and this answer for insight about how a hazard ratio might be interpreted if PH is violated.
Don't just depend on the tabular output from cox.zph()
. Do look carefully at the scaled Schoenfeld residual plots for each covariate against time. You might need to use your judgment, based on your knowledge of the subject matter, to determine whether a statistically significant violation of PH is also practically significant or to identify particular time periods that warrant special treatment.
*It's not clear to me whether prior versions of cox.zph()
incorporated weights into the calculations, although weighted residuals needed for the test could in principle have been determined. So check the software version you are using.