plot.pec | R Documentation |
Plotting prediction error curves for one or more prediction models.
## S3 method for class 'pec'
plot(
x,
what,
models,
xlim = c(x$start, x$minmaxtime),
ylim = c(0, 0.3),
xlab = "Time",
ylab,
axes = TRUE,
col,
lty,
lwd,
type,
smooth = FALSE,
add.refline = FALSE,
add = FALSE,
legend = ifelse(add, FALSE, TRUE),
special = FALSE,
...
)
x |
Object of class |
what |
The name of the entry in |
models |
Specifies models in |
xlim |
Plotting range on the x-axis. |
ylim |
Plotting range on the y-axis. |
xlab |
Label given to the x-axis. |
ylab |
Label given to the y-axis. |
axes |
Logical. If |
col |
Vector of colors given to the curves of |
lty |
Vector of lty's given to the curves of |
lwd |
Vector of lwd's given to the curves of |
type |
Plotting type: either |
smooth |
Logical. If |
add.refline |
Logical. If |
add |
Logical. If |
legend |
if TRUE a legend is plotted by calling the function legend.
Optional arguments of the function |
special |
Logical. If |
... |
Extra arguments that are passed to |
From version 2.0.1 on the arguments legend.text, legend.args, lines.type,
lwd.lines, specials are obsolete and only available for backward
compatibility. Instead arguments for the invoked functions legend
,
axis
, Special
are simply specified as legend.lty=2
. The
specification is not case sensitive, thus Legend.lty=2
or
LEGEND.lty=2
will have the same effect. The function axis
is
called twice, and arguments of the form axis1.labels
, axis1.at
are used for the time axis whereas axis2.pos
, axis1.labels
,
etc. are used for the y-axis.
These arguments are processed via ...{}
of plot.pec
and
inside by using the function resolveSmartArgs
. Documentation of
these arguments can be found in the help pages of the corresponding
functions.
The (invisible) object.
Ulla B. Mogensen ulmo@biostat.ku.dk, Thomas A. Gerds tag@biostat.ku.dk
pec
summary.pec
Special
prodlim
# simulate data
# with a survival response and two predictors
library(prodlim)
library(survival)
set.seed(280180)
dat <- SimSurv(100)
# fit some candidate Cox models and
# compute the Kaplan-Meier estimate
Models <- list("Kaplan.Meier"=survfit(Surv(time,status)~1,data=dat),
"Cox.X1"=coxph(Surv(time,status)~X1,data=dat,x=TRUE,y=TRUE),
"Cox.X2"=coxph(Surv(time,status)~X2,data=dat,x=TRUE,y=TRUE),
"Cox.X1.X2"=coxph(Surv(time,status)~X1+X2,data=dat,x=TRUE,y=TRUE))
Models <- list("Cox.X1"=coxph(Surv(time,status)~X1,data=dat,x=TRUE,y=TRUE),
"Cox.X2"=coxph(Surv(time,status)~X2,data=dat,x=TRUE,y=TRUE),
"Cox.X1.X2"=coxph(Surv(time,status)~X1+X2,data=dat,x=TRUE,y=TRUE))
# compute the .632+ estimate of the generalization error
set.seed(17100)
PredError.632plus <- pec(object=Models,
formula=Surv(time,status)~X1+X2,
data=dat,
exact=TRUE,
cens.model="marginal",
splitMethod="boot632plus",
B=5,
keep.matrix=TRUE,
verbose=TRUE)
# plot the .632+ estimates of the generalization error
plot(PredError.632plus,xlim=c(0,30))
# plot the bootstrapped curves, .632+ estimates of the generalization error
# and Apparent error for the Cox model 'Cox.X1' with the 'Cox.X2' model
# as benchmark
plot(PredError.632plus,
xlim=c(0,30),
models="Cox.X1",
special=TRUE,
special.bench="Cox.X2",
special.benchcol=2,
special.addprederr="AppErr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.