Survival Analysis – Interactions with Time-Dependent Covariates

data visualizationsurvivaltime-varying-covariate

I am new to R and I just wanted to know if it is possible to test an interaction between a time-varying covariate and a time-invariant covariate in survival analysis?

A related question is, can you plot the time-dependent covariate effect on survival for different groups?

Thanks!

coxph4b <- coxph(Surv(start, stop, frust_event) ~ avoid + newSDQtgr + avoid:newSDQtgr + frailty(id),
                 ties = c ("efron"),
                 data = frustrec2a)
summary(coxph4b)
frust.surv<-survfit(coxph4b)
frust.surv <- survfit(Surv(second, frust_event) ~ avoid:newSDQtgr, data = frustrec2)
plot(frust.surv, lty = 2:3)
legend(100, .9, c("avoid", "no avoid"), lty = 2:3)
title("Kaplan-Meier Curves for children's recurring aggression")
lsurv2 <- survfit(Surv(second, frust_event) ~ avoid*newSDQtgr, frustrec2, type='fleming')
plot(lsurv2, lty=2:3, fun="cumhaz",
     xlab="Seconds", ylab="Cumulative Hazard")

Best Answer

Survival analysis is performed at event times. What matters at each event time in a Cox proportional hazards regression is the set of current values of covariates for the case that had the event, versus current covariate values for those still at risk who didn't have the event.

A regression coefficient and interaction terms involving a time-varying covariate are thus no different from those for a time-invariant covariate. The regression coefficients and associated hazard ratios are still constant over time. That means that the effect on survival associated with any particular value of the time-varying covariate is constant over time. All that differs is that the values of the time-varying covariates can vary with time.

Once you have a model you certainly can plot predicted survival for members of any particular groups or combinations of covariate values, and you can even allow for time-varying values of covariates in the new data that you provide to the model if you format the data properly. This can be done, for example, with the survfit.coxph() function in the R survival package. The help page includes the following critical warning, however:

... although predictions with a time-dependent covariate path can be useful, it is very easy to create a prediction that is senseless. Users are encouraged to seek out a text that discusses the issue in detail.

Things are more complicated if you are considering time-varying coefficients for covariates. The time-dependent vignette provided with the survival package is an introduction to issues with respect to time-dependent covariates and coefficients.

Related Question