powered by
Tis is a ggplot version of plot.cox.zph. Displays a graph of the scaled Schoenfeld residuals, along with a smooth curve.
coxzphplot(x, resid = TRUE, se = TRUE, var = NULL, hr = FALSE, add.lm = FALSE)
A facetted ggplot
result of the cox.zph function.
a logical value, if TRUE the residuals are included on the plot, as well as the smooth fit.
a logical value, if TRUE, confidence bands at two standard errors will be added.
The set of variables for which plots are desired. It can be integer or variable names
logical If true, plot for hazard ratio, If false, plot for coefficients
logical If true, add linear regression line
library(survival) vfit <- coxph(Surv(time,status) ~ trt + factor(celltype) + karno + age, data=veteran, x=TRUE) x <- cox.zph(vfit) coxzphplot(x) coxzphplot(x,var="karno",add.lm=TRUE)
Run the code above in your browser using DataLab