| gg_survival | R Documentation |
Nonparametric survival estimates.
gg_survival(
object = NULL,
interval = NULL,
censor = NULL,
by = NULL,
data = NULL,
type = c("kaplan", "nelson"),
...
)
## S3 method for class 'rfsrc'
gg_survival(
object,
interval = NULL,
censor = NULL,
by = NULL,
data = NULL,
type = c("kaplan", "nelson"),
...
)
## Default S3 method:
gg_survival(
object = NULL,
interval = NULL,
censor = NULL,
by = NULL,
data = NULL,
type = c("kaplan", "nelson"),
...
)
object |
For the |
interval |
Character; name of the time-to-event column in |
censor |
Character; name of the event-indicator column in |
by |
Optional character; name of a grouping column for stratified
estimates. For the |
data |
A |
type |
One of |
... |
Additional arguments passed to |
gg_survival is an S3 generic for generating nonparametric
survival estimates. It dispatches on the class of its first argument:
rfsrcExtracts the response data from the fitted forest and
delegates to kaplan. Use the by argument to
stratify on a predictor stored in the model's xvar slot.
Accepts raw survival data columns via the interval,
censor, by, and data arguments, delegating to
either kaplan (default) or nelson.
A gg_survival data.frame with columns time,
surv, cum_haz, lower, upper, n.risk,
and optionally groups when by is supplied.
kaplan nelson
plot.gg_survival
## -------- pbc data (default method — raw data columns)
data(pbc, package = "randomForestSRC")
pbc$time <- pbc$days / 364.25
gg_dta <- gg_survival(interval = "time", censor = "status", data = pbc)
plot(gg_dta, error = "none")
# Stratified
gg_dta <- gg_survival(
interval = "time", censor = "status",
data = pbc, by = "treatment"
)
plot(gg_dta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.