Summary

This document provides a detailed explanation of time-varying covariates within the context of Cox proportional hazards models. It emphasizes the importance of structured start-stop time data for modeling survival. The document also introduces the tmerge() function within the R survival package, demonstrating how it aids in preparing data for survival analysis.

Full Transcript

Time-varying covariates The Cox PH model easily accommodates time-varying covariates, but the data should be structured in start-stop time format: ■ each subject can have multiple rows of data ■ 2 time variables are required to record the beginning and end of time intervals ■ The status variable rec...

Time-varying covariates The Cox PH model easily accommodates time-varying covariates, but the data should be structured in start-stop time format: ■ each subject can have multiple rows of data ■ 2 time variables are required to record the beginning and end of time intervals ■ The status variable records the event status as the end at each interval • for single event data, this can only be the last interval ■ If no time gaps, the start time of an interval will be the stop time of the previous interval ■ The time when a covariate changes value should be recorded as the beginning of a new interval The survival package provides a function tme rge () to help get your data in this format. See vi gnette (ti medep) for guidance on its usage. The j asal dataset, which looks at survival for patients on a waiting list for heart transplant, is already set up in this format: In this data set, trans pl ant is a time-varying covariate: head(jasal) ## ## ## ## ## ## ## 1 2 102 3 103 4 id start stop event transplant age year surgery 1 0 49 1 0 -17.155373 0.1232033 0 2 0 5 1 0 3.835729 0.2546201 0 3 0 15 1 1 6.297057 0.2655715 0 4 0 35 0 0 -7.737166 0.4900753 0 4 1 1 -7.737166 0.4900753 35 38 0 17 1 5 0 0 -27.214237 0.6078029 0 The data are ready for coxph (). UsetheSurv(time, time2, event) specification. jasal.cox <- coxph(Surv(start, stop, event) ~ transplant + age + surgery, datajasal) summary(jasal.cox) ## Call: ## coxph(formula = Surv(start, stop, event) ~ transplant + age + ## surgery, data = jasal) # # # # # # # # # ## ## ## ## ## ## ## ## ## # # # # # # # # n= 170, number of events= 75 # coef exp(coef) se(coef) z Pr(>|z|) transplant 0.01405 1.01415 0.30822 0.046 0.9636 age 0.03055 1.03103 0.01389 2.199 0.0279 * surgery -0.77326 0.46150 0.35966 -2.150 0.0316 * --Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 0.1 ' ' 1 transplant age surgery exp(coef) exp(-coef) lower .95 upper .95 1.0142 0.9860 0.5543 1.8555 0.9699 1.0310 1.0033 1.0595 0.4615 2.1668 0.2280 0.9339 Concordance= 0.599 (se = 0.036 ) Likelihood ratio test= 10.72 on 3 df, p=0.01 Wald test = 9.68 on 3 df, p=0.02 Score (logrank) test =10 on 3 df, p=0.02 We can follow with the same procedures as before, checking PH assumptions and plotting predicted survival curves. # check PH assumptions cox.zph(jasal.cox) ## ## ## ## ## transplant age surgery GLOBAL chisq df P 0.118 1 0.73 0.897 1 0.34 0.097 1 0.76 1.363 3 0.71 # piot predicted survival, by transplant group at mean age and surgery=0 plotdata <- data.frame(transplant=0:1, age=-2.48, surgery=0) surv.by.transplant <- survfit(jasal.cox, newdata=plotdata) ggsurvplot(surv.by.transplant, datplotdata) # remember to supply data to ggsurvplot() for predicted survival after coxph() 1.00- Survival probability 0.75- 0.25- o.oo0 500 Strata -h 1 h- 2 1000 Time 1500 2000 Exercise 2 Now we will fit a Cox proprotional hazards model to the vete ran data set. ■ ti me: survival time in weeks ■ status: status, o=censored, i=dead ■ trt: treatment, i=standard, 2=test ■ age: age 1. Use a Cox proportional hazards model to estimate hazard ratios for the effects of treatment and Karnofsky performance score. Interpret the estimated hazard ratios. 2. Assess the proportional hazards assumption for both covariates using a chi-square test and graphs. 3. Fit a Cox model that allows the effect of t rt to change over time (even though the original model was not very useful). More about survival analysis More R stuff The coxphO function has some additional flexibility, including: ■ recurrent events modeling (see vi gnette("survival")) ■ competing risks modeling (see vignette ("survival ")) ■ frailty random effects, see ?f rai 1 ty for more, but in general, use the coxme package ■ robust and cluster robust variance estimation, see the robust and cl uster options in ?coxph ■ weights that can be treated as replication/frequency or sampling weights, see the wei ghts argument in ?coxph The su rvi val package has the su rvreg () function for parametric regression models. Additional useful survival analysis packages । coxme package, frailty random effects models, also written by Therneau References References for the survival package The su rvi val package has some of the best vignettes (tutorials) of any R package. Key vignettes for getting started (use vi gnette(package="survival") to see a full list): ■ vi gnette("survi val") for a general introduction of the usage and capabilities of the survival package, as well as some theoretical survival analysis background ■ vi gnette("ti medep") for guidance modeling time-varying covariates and time-varying coefficients References for survival analysis Grambsch, P. &Therneau, T. (1994), Proportional hazards tests and diagnostics based on weighted residuals. Biometrika, 81, 51526. Therneau, T. M. & Grambsch, P. M. (2000). Modeling Survival Data: Extending the Cox Model, Third Edition. New York: Springer. Kleinbaum, D. G., & Klein, M. (2012). Survival analysis: a self-learning text (Vol. 3). New York: Springer.

Use Quizgecko on...
Browser
Browser