Solved – Violation of proportional hazard for covariate but not for interaction it’s part of in a Cox Proportional Hazards model

assumptionscox-modelinteractionsurvival

I have a problem in which one of the covariates in my model violates the assumption of proportional hazards, but the interaction it is part of does not.

Data info:
Lifespan – mosquito time to death (not censored)
feed_time – categorical variable: AM / PM
treatment – categorical variable: infected / uninfected
clutch – continuous variable
cage – cages in which my mosquitoes are housed (i'm using cluster(cage) as mosquitoes within a cage are not independent)

Results of min model:
Cox Proportional Hazards Model

 cph(formula = Surv(lifespan) ~ feed_time + treatment * clutch1 + 
     cluster(cage), data = df, x = T, y = T)

 Frequencies of Missing Values Due to Each Variable
 Surv(lifespan)      feed_time      treatment        clutch1      feed_time 
         2              0              0              0              0 


                 Model Tests       Discrimination    
                                      Indexes        
Obs        298    LR chi2     17.47    R2       0.057    
Events     298    d.f.            4    Dxy      0.133    
Center -0.2016    Pr(> chi2) 0.0016    g        0.281    
                  Score chi2  17.84    gr       1.324    
                  Pr(> chi2) 0.0013                      


                             Coef    S.E.   Wald Z Pr(>|Z|)
feed_time=PM                 -0.3300 0.1402 -2.35  0.0185  
treatment=Infected           -0.2582 0.1564 -1.65  0.0988  
clutch1                      -0.0008 0.0017 -0.48  0.6346  
treatment=Infected * clutch1  0.0073 0.0023  3.18  0.0015

Results of cox.zph:

                                rho    chisq     p
feed_time=PM                  0.000771 0.000251 0.987
treatment=Infected            0.117886 4.548338 0.033
clutch1                       0.072919 1.551721 0.213
treatment=Infected * clutch1 -0.066628 1.084940 0.298

result of cox.zph

So i've had a read of literature and i'm aware that in cases of violated prop hazard i can either create an interaction between the covariate and time (which wouldn't be ideal as i'm interested in the effect of Treatment) OR stratify my covariate (which i'm not sure you can do with a categorical variable? I've only seen examples with continuous variables).

However, i don't know what is appropriate to do when a covariate lies within an interaction in the same model. If someone could prod me in the right direction for what to do next that would be amazing. I've been knocking my head against this for a while.

edit:
Here's the log-log plot for treatment

 myfit <- npsurv(Surv(lifespan) ~ treatment, data=df)  
 survplot(myfit, loglog=T)

enter image description here

Best Answer

In your model you need to add an interaction term for the infected:

cph(formula = Surv(start_time, end_time, event) ~ feed_time + 
    treatment * clutch1 + treatment:start_time + 
    cluster(cage), data = df, x = T, y = T)

See my own answer here and my blog about this here. Since you have a limited amount of data you can also use the tt() approach although I'm uncertain if it works as expected with the rms::cph wrapper.

coxph(formula = Surv(lifespan) ~ feed_time + 
      treatment * clutch1 + tt(treatment) + 
      cluster(cage), data = df, x = T, y = T,
      tt = function(x, t, ...){
        ns(x + t, 2)
      })

If you stratify on your main variable you won't get an estimate and you can't do an interaction variable with the clutch1 variable. I may have misread your question but just to be sure, stratification can only be used with categorical variables and not continuous. You can categorize continuous variables but I wouldn't recommend that.