| plot.wnpmle_pred | R Documentation |
Plots the result of predict() for a wnpmle fit: one curve per
row of newdata, with pointwise confidence bands. For competing-risks
fits (type = "cmprsk") the curves are cumulative incidences, for
recurrent events marginal means.
## S3 method for class 'wnpmle_pred'
plot(
x,
conf_int = !add,
add = FALSE,
xscale = 1,
type = c("s", "l"),
col = NULL,
lty = NULL,
lwd = NULL,
band_col = NULL,
band_alpha = 0.15,
labels = NULL,
legend = if (add) FALSE else "auto",
xlab = NULL,
ylab = NULL,
main = NULL,
xlim = NULL,
ylim = NULL,
...
)
x |
Result of |
conf_int |
Logical; draw the pointwise confidence bands, if available
(default |
add |
Logical; add the curves to the current plot, e.g. to compare two
models (default |
xscale |
The time axis is divided by |
type |
|
col, lty, lwd |
Colour, line type and line width, recycled over the
curves. Default: grey shades from black, solid lines (dashed with
|
band_col |
Colour of the confidence bands (default: |
band_alpha |
Transparency of the confidence bands (default 0.15). |
labels |
Legend labels, one per curve. By default built from the
covariates that differ between the rows of |
legend |
Position of the legend, e.g. |
xlab, ylab, main, xlim, ylim |
Axis labels, title and axis limits. The y-axis label depends on the type of prediction. |
... |
Further graphical parameters passed to |
x, invisibly.
library(survival)
tp <- survival::transplant
tp <- tp[tp$futime > 0 & complete.cases(tp), ]
tp$status <- ifelse(tp$event == "ltx", 1, ifelse(tp$event == "censored", 0, 2))
fit <- wnpmle_fit(Surv(futime, status) ~ age + sex + abo, data = tp,
type = "cmprsk", model = "boxcox", rho = 1)
nd <- data.frame(age = 50, sex = factor("m", levels = levels(tp$sex)),
abo = factor(c("A", "O"), levels = levels(tp$abo)))
p <- predict(fit, newdata = nd)
plot(p, xscale = 365.25, xlab = "Years on the waiting list")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.