tchoup
tchoup

Reputation: 1023

testing for proportional hazards: cox.zph()

I am confused on what the cox.zph is showing. I came across this test in documentation for the finalfit package, and there was this bit under the heading "Testing for Proportional Hazards" about halfway down, which suggested testing the assumption that the risk associated with a particular variable does not change over time.

I ran it through using the code, but the info seems to imply that I want a straight line from zero (which I have in the graph), and that hypothesis test should not have variables that significantly differ from zero (which I don't have). This seems like a contradiction: Does anyone have any insight in where I may be going wrong here.

matt_sfit1 <- coxph(Surv(matt_tmove_cen, matt_moved_cen)~
                matt_ncdem + flood_risk_simple + pre_matt.yr + CurrentAge + distance_bi + percap.inc.k + employment + rentership + pop.change + pop.den.k,
                data=matt_timeadd)

matt_sfit1 %>% cox.zph()
                      chisq df                      p
matt_ncdem         39.22057  1   0.000000000378530830
flood_risk_simple  28.56281  1   0.000000090707709686
pre_matt.yr         7.96306  1              0.0047742
CurrentAge          5.83612  1              0.0157004
distance_bi       141.75756  1 < 0.000000000000000222
percap.inc.k       58.80923  1   0.000000000000017372
employment         30.16208  1   0.000000039740433777
rentership          8.69457  1              0.0031916
pop.change         36.13011  1   0.000000001845730660
pop.den.k           9.56108  1              0.0019875
GLOBAL            281.42991 10 < 0.000000000000000222

matt_sfit1 %>% cox.zph() %>%  {zph_result <<- .} %>% plot(var=5)

enter image description here

Upvotes: 0

Views: 1018

Answers (1)

Alessandro
Alessandro

Reputation: 46

Testing for proportionality is very important. If the proportional hazards assumption is rejected, it means that the effect of interest varies over time, and that the 'pooled' coefficient you are looking at is actually an average of different underlying values.

The first test you reported gives an overview of whether the PH assumption holds, i.e. of whether the effect of interest is constant over time. A graphical inspection can be informative in detecting 'when' this variation happens (for example, a covariate may have a stronger effect earlier/later on; this can sometimes be expected from a theoretical point of view). I think that the chosen y-scale is hiding a non-horizontal line. I would try to isolate the smoothed curve by removing the observation points. You have to specify the resid=FALSE argument in plot. The two tests shuold give you a coherent outcome.

Past threads (among the others, here and here) offer excellent guidance on how to address the issue.

Upvotes: 1

Related Questions