CoxPH_Diagnostics: Cox-PH model assumptions This function outputs a bunch of...

Description Usage Arguments Value See Also Examples

View source: R/coxph_model_assumptions.R

Description

Cox-PH model assumptions This function outputs a bunch of plots related to Cox-PH diagnostics and model assumptions. Based on "Amendment 2 DFCI Analyses 3November2017.R"

Usage

1
CoxPH_Diagnostics(model, data, continuous_vars, save_prefix)

Arguments

model

A cox-ph fitted model object

data

The data.frame containing the covariates used to generate the model

continuous_vars

A character vector of the names of the continuous variables used in the model

save_prefix

The file prefix for saving the output. E.g., "Results/coxph_"

Value

This function doesn't return anything, but writes four plots to disk: the scaled schoenfeld residuals, dfBetas, Deviance and Martingale residuals. These plots can be used to e.g. diagnose issues with the model, find outliers or find time-varying trends.

See Also

"Checking the Cox model with cumulative sums of martingale-based residuals." Biometrika 80.3 (1993): 557-572. "Using Time Dependent Covariates..." (https://cran.r-project.org/web/packages/survival/vignettes/timedep.pdf) "Proportional Hazards Regression Diagnostics" (http://www.ics.uci.edu/~dgillen/STAT255/Handouts/lecture10.pdf)

Examples

1
2
3
4
data(veteran)
model <- coxph(Surv(time, status) ~ ., data=veteran)
cvars <- c("karno", "diagtime", "age")
CoxPH_Diagnostics(model, data=veteran, continuous_vars=cvars, save_prefix="~/Desktop/coxph_veteran_")

AdaptiveCompBio/EOS documentation built on March 19, 2018, 3:13 a.m.