Last data update: 2014.03.03

R: Graphical Test of Proportional Hazards using ggplot2
ggcoxzphR Documentation

Graphical Test of Proportional Hazards using ggplot2

Description

Displays a graph of the scaled Schoenfeld residuals, along with a smooth curve using ggplot2. Wrapper around plot.cox.zph.

Usage

ggcoxzph(fit, resid = TRUE, se = TRUE, df = 4, nsmo = 40, var,
  point.col = "red", point.size = 1, point.shape = 19, point.alpha = 1,
  font.main = c(16, "plain", "black"), font.x = c(14, "plain", "black"),
  font.y = c(14, "plain", "black"), font.tickslab = c(12, "plain", "black"),
  ggtheme = theme_classic2())

## S3 method for class 'ggcoxzph'
print(x, ...)

Arguments

fit

an object of class cox.zph.

resid

a logical value, if TRUE the residuals are included on the plot, as well as the smooth fit.

se

a logical value, if TRUE, confidence bands at two standard errors will be added.

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.

var

the set of variables for which plots are desired. By default, plots are produced in turn for each variable of a model.

point.col, point.size, point.shape, point.alpha

color, size, shape and visibility to be used for points.

font.main, font.x, font.y, font.tickslab

a vector of length 3 indicating respectively the size (e.g.: 14), the style (e.g.: "plain", "bold", "italic", "bold.italic") and the color (e.g.: "red") of main title, xlab and ylab and axis tick labels, respectively. For example font.x = c(14, "bold", "red"). Use font.x = 14, to change only font size; or use font.x = "bold", to change only font face.

ggtheme

function, ggplot2 theme name. Default value is survminer::theme_classic2(). Allowed values include ggplot2 official themes: theme_gray(), theme_bw(), theme_minimal(), theme_classic(), theme_void(), ....

x

an object of class ggcoxzph

...

further arguments passed to print, but really it's unused

Value

Returns an object of class ggcoxzph which is a list of ggplots.

Functions

  • ggcoxzph: Graphical Test of Proportional Hazards using ggplot2.

Author(s)

Marcin Kosinski , m.p.kosinski@gmail.com

Examples


library(survival)
fit <- coxph(Surv(futime, fustat) ~ age + ecog.ps, data=ovarian)
cox.zph.fit <- cox.zph(fit)
ggcoxzph(cox.zph.fit)

Results