View source: R/survival_operations.R
plot.surv_object | R Documentation |
Plot general survival models
## S3 method for class 'surv_object'
plot(
x,
times = seq.int(0, 30),
type = c("surv", "prob"),
psa,
Nrep = 100,
join_opts = list(join_col = "red", join_pch = 20, join_size = 3),
...
)
x |
a survival object of class |
times |
Times at which to evaluate and plot the survival object. |
type |
either |
psa |
a |
Nrep |
The number of replications to estimate the variability of |
join_opts |
A list of 3 graphical parameters for points at which different survival functions are joined: join_col, join_pch and join_size. |
... |
additional arguments to pass to |
The function currently only highlights join points that are at
the top level; that is, for objects with class surv_projection
.
To avoid plotting the join points, set join_size to a negative number.
a ggplot2::ggplot()
object.
## Evaluation of the variability of the survival distribution
surv1 <- define_surv_dist("exp", rate = 0.1)
psa <- define_psa(surv1 ~ resample_surv(n = 100))
plot(surv1, psa=psa)
## plot surv_projection object
surv2 <- define_surv_dist("exp", rate = 0.5)
plot(join(surv1, surv2, at = 2), psa = psa, Nrep = 50)
## surv_fit object
library(survival)
km <- define_surv_fit(survfit(formula = Surv(time, status) ~ 1, data = aml))
fs <- flexsurv::flexsurvreg(formula = Surv(time, status) ~ 1,
data = aml,
dist = "weibull") |>
define_surv_fit()
psa2 <- define_psa(km ~ resample_surv(),
fs ~ resample_surv(),
surv1 ~ resample_surv(100))
plot(km, psa = psa2)
plot(join(km, surv1, at = 6), psa = psa2)
plot(join(fs, surv1, at = 6), psa = psa2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.