View source: R/plotPredictRisk.R
plotPredictRisk | R Documentation |
Time-dependent event risk predictions.
plotPredictRisk(
x,
newdata,
times,
cause = 1,
xlim,
ylim,
xlab,
ylab,
axes = TRUE,
col,
density,
lty,
lwd,
add = FALSE,
legend = TRUE,
percent = FALSE,
...
)
x |
Object specifying an event risk prediction model. |
newdata |
A data frame with the same variable names as those that were
used to fit the model |
times |
Vector of times at which to return the estimated probabilities. |
cause |
Show predicted risk of events of this cause |
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 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 |
legend |
Logical. If TRUE a legend is plotted by calling the function
legend. Optional arguments of the function |
percent |
Logical. If |
... |
Parameters that are filtered by |
Arguments for the invoked functions legend
and axis
can be
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
plotPredictRisk
and inside by using the function
SmartControl
.
The (invisible) object.
Ulla B. Mogensen and Thomas A. Gerds tag@biostat.ku.dk
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. URL http://www.jstatsoft.org/v50/i11/.
plotRisk
library(survival)
# generate survival data
# no effect
set.seed(8)
d <- sampleData(80,outcome="survival",formula = ~f(X6, 0) + f(X7, 0))
d[,table(event)]
f <- coxph(Surv(time,event)~X6+X7,data=d,x=1)
plotPredictRisk(f)
# large effect
set.seed(8)
d <- sampleData(80,outcome="survival",formula = ~f(X6, 0.1) + f(X7, -0.1))
d[,table(event)]
f <- coxph(Surv(time,event)~X6+X7,data=d,x=1)
plotPredictRisk(f)
# generate competing risk data
# small effect
set.seed(8)
d <- sampleData(40,formula = ~f(X6, 0.01) + f(X7, -0.01))
d[,table(event)]
f <- CSC(Hist(time,event)~X5+X6,data=d)
plotPredictRisk(f)
# large effect
set.seed(8)
d <- sampleData(40,formula = ~f(X6, 0.1) + f(X7, -0.1))
d[,table(event)]
f <- CSC(Hist(time,event)~X5+X6,data=d)
plotPredictRisk(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.