plot.coxph {RcmdrPlugin.survival} | R Documentation |
Plots the predicted survival function from a coxph
object, setting covariates to particular values.
## S3 method for class 'coxph': plot(x, newdata, typical = mean, byfactors=FALSE, col = palette(), lty, conf.level = 0.95, ...)
x |
a coxph object. |
newdata |
a data frame containing (combinations of) values to which predictors are set; optional. |
typical |
function to use to compute "typical" values of numeric predictors. |
byfactors |
if TRUE , different lines are drawn for each unique combination of factor values,
including strata; if FALSE (the default) distinct lines are drawn only for different
strata, with all columns of the model matrix (including for factors) set to their means. |
col |
colors for lines. |
lty |
line-types for lines; if missing, defaults to 1 to number required. |
conf.level |
level for confidence intervals; note: whether or not confidence intervals are
plotted is determined by plot.survfit , which plot.coxph calls; if a
conf.int argument is supplied it is passed through. |
... |
arguments passed to plot . |
If newdata
is missing then all combinations of levels of factor-predictors (or strata),
if present, are combined with "typical" values of numeric predictors.
Invisibly returns the summary
resulting from applying survfit.coxph
to the coxph
object.
John Fox jfox@mcmaster.ca.
coxph
, survfit.coxph
,
plot.survfit
.
require(survival) cancer$sex <- factor(ifelse(cancer$sex == 1, "male", "female")) mod.1 <- coxph(Surv(time, status) ~ age + wt.loss, data=cancer) plot(mod.1) plot(mod.1, typical=function(x) quantile(x, c(.25, .75))) mod.2 <- coxph(Surv(time, status) ~ age + wt.loss + sex, data=cancer) plot(mod.2) mod.3 <- coxph(Surv(time, status) ~ (age + wt.loss)*sex, data=cancer) plot(mod.3) mod.4 <- coxph(Surv(time, status) ~ age + wt.loss + strata(sex), data=cancer) plot(mod.4) mods.1 <- survreg(Surv(time, status) ~ age + wt.loss, data=cancer)