fortify.cox.zph: Create data structures from survival hazard Cox Regression

Description Usage Arguments Value Note Examples

Description

This function generates data to be used with ggplot2 and is custom- tailored for use with gg_cox_zpn. It returns a list the length of x with names matching the row names of the output of cox.zph.

Each list element has two data.frames, resid and pred matching the residuals and fit+confidence interval for that element along with ylab (which matches the list element name) and a boolean log which indicates whether a log scale should be used.

Usage

1
2
## S3 method for class 'cox.zph'
fortify(x, df = 4, nsmo = 40)

Arguments

x

result of the cox.zph function.

df

the degrees of freedom for the fitted natural spline, df=2 leads to a linear fit.

nsmo

number of points used to plot the fitted spline.

Value

list with residuals and fit+confidence intervals for each component of x

Note

Designed to be used with gg_cox_zph but can be used separately.

Examples

1
2
3
4
5
6
library(survival)
library(ggplot2)
vfit <- coxph(Surv(time,status) ~ trt + factor(celltype) +
              karno + age, data=veteran, x=TRUE)

gg_cox_zph(fortify(cox.zph(vfit)))

hrbrmstr/gghazard documentation built on May 17, 2019, 5:08 p.m.