plotPredictSurvProb {pec}R Documentation

Plotting predicted survival curves.

Description

Ploting prediction survival curves for one prediction model using predictSurvProb .

Usage

plotPredictSurvProb(
  x,
  newdata,
  times,
  xlim,
  ylim,
  xlab,
  ylab,
  axes = TRUE,
  col,
  density,
  lty,
  lwd,
  add = FALSE,
  legend = TRUE,
  percent = FALSE,
  ...
)

Arguments

x

A survival prediction model including call and formula object.

newdata

A data frame with the same variable names as those that were used to fit the model x.

times

Vector of times at which to return the estimated probabilities.

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 FALSE no axes are drawn.

col

Vector of colors given to the survival curve.

density

Densitiy of the color – useful for showing many (overlapping) curves.

lty

Vector of lty's given to the survival curve.

lwd

Vector of lwd's given to the survival curve.

add

Logical. If TRUE only lines are added to an existing device

legend

Logical. If TRUE a legend is plotted by calling the function legend. Optional arguments of the function legend can be given in the form legend.x=val where x is the name of the argument and val the desired value. See also Details.

percent

Logical. If TRUE the y-axis is labeled in percent.

...

Parameters that are filtered by SmartControl and then passed to the functions: plot, axis, legend.

Details

Arguments for the invoked functions legend and axis 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 plotPredictSurvProb and inside by using the function SmartControl.

Value

The (invisible) object.

Author(s)

Ulla B. Mogensen ulmo@biostat.ku.dk, Thomas A. Gerds tag@biostat.ku.dk

References

Ulla B. Mogensen, Hemant Ishwaran, Thomas A. Gerds (2012). Evaluating Random Forests for Survival Analysis Using Prediction Error Curves. Journal of Statistical Software, 50(11), 1-23. DOI 10.18637/jss.v050.i11

See Also

predictSurvProbprodlim

Examples


# generate some survival data
library(prodlim)
d <- SimSurv(100)
# then fit a Cox model
library(survival)
library(rms)
coxmodel <- cph(Surv(time,status)~X1+X2,data=d,surv=TRUE)
# plot predicted survival probabilities for all time points
ttt <- sort(unique(d$time))
# and for selected predictor values:
 ndat <- data.frame(X1=c(0.25,0.25,-0.05,0.05),X2=c(0,1,0,1))
plotPredictSurvProb(coxmodel,newdata=ndat,times=ttt)


[Package pec version 2023.04.12 Index]