knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-", fig.retina =2 )
gghazard : Improved Base and Grid Plots for Survival Hazard Cox Regression
The following functions are implemented:
fortify.cox.zph
: Create data structures from survival hazard Cox Regressiongg_cox_zph
: Graphical Test of Proportional Hazards (ggplot2/grid)plot.cox.zph
: Graphical Test of Proportional Hazards (base)devtools::install_github("hrbrmstr/gghazard")
options(width=120)
library(survival) library(ggplot2) library(gghazard) # current verison packageVersion("gghazard") vfit <- coxph(Surv(time, status) ~ trt + factor(celltype) + karno + age, data=veteran, x=TRUE)
gg_cox_zph(fortify(cox.zph(vfit)), pred_col="maroon")
par(mfrow=c(2, 3)) plot(cox.zph(vfit), smoothcol="maroon", confcol="maroon") par(mfrow=c(1, 1))
library(gghazard) library(testthat) date() test_dir("tests/")
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.