Displays graphs of continuous explanatory variable against martingale residuals of null
cox proportional hazards model, for each term in of the right side of formula
. This might help to properly
choose the functional form of continuous variable in cox model (coxph). Fitted lines with lowess function
should be linear to satisfy cox proportional hazards model assumptions.
1 2 3 4 5 6 7 8  ggcoxfunctional(formula, data = NULL, fit, iter = 0, f = 0.6,
point.col = "red", point.size = 1, point.shape = 19, point.alpha = 1,
xlim = NULL, ylim = NULL,
ylab = "Martingale Residuals \nof Null Cox Model", title = NULL,
caption = NULL, ggtheme = theme_survminer(), ...)
## S3 method for class 'ggcoxfunctional'
print(x, ..., newpage = TRUE)

formula 
a formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the Surv function. 
data 
a 
fit 
an object of class coxph.object  created with coxph function. 
iter 
parameter of lowess. 
f 
parameter of lowess. 
point.col, point.size, point.shape, point.alpha 
color, size, shape and visibility to be used for points. 
xlim, ylim 
x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1). 
ylab 
y axis label. 
title 
the title of the final grob ( 
caption 
the caption of the final grob ( 
ggtheme 
function, ggplot2 theme name. Default value is theme_classic2.
Allowed values include ggplot2 official themes: see 
... 
further arguments passed to the function 
x 
an object of class ggcoxfunctional 
newpage 
open a new page. See 
Returns an object of class ggcoxfunctional
which is a list of ggplots.
ggcoxfunctional
: Functional Form of Continuous Variable in Cox Proportional Hazards Model.
Marcin Kosinski , m.p.kosinski@gmail.com
1 2 3 4 5 6 7  library(survival)
data(mgus)
res.cox < coxph(Surv(futime, death) ~ mspike + log(mspike) + I(mspike^2) +
age + I(log(age)^2) + I(sqrt(age)), data = mgus)
ggcoxfunctional(res.cox, data = mgus, point.col = "blue", point.alpha = 0.5)
ggcoxfunctional(res.cox, data = mgus, point.col = "blue", point.alpha = 0.5,
title = "Pass the title", caption = "Pass the caption")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.