| augment_survival | R Documentation |
Draws one latent event time per process for every row of data, from the
Weibull hazard of define_survival(). The times are uncensored: censoring
and competing-risk coding are applied afterwards, for example with
combine_competing_risks(). An event with several rows in specification
has a piecewise hazard, whose scale and shape must stay constant across
its segments.
augment_survival(
data,
specification,
seed = NULL,
digits = NULL,
envir = parent.frame()
)
data |
Baseline base |
specification |
Definitions from |
seed |
Optional random seed. A single number, or |
digits |
Optional number of decimal places the event times are rounded
to. A single non-negative whole number, or |
envir |
Environment the formulas are evaluated in after the data columns. Defaults to the caller's environment. |
A simulab_sim base data.frame with the columns of data followed
by one numeric event-time column per process, named by its event, and one
row per input row. The component survival_definitions, reached with
as.data.frame(x, what = "survival_definitions"), is the specification as
a plain data.frame.
data <- data.frame(id = 1:100, treatment = rep(0:1, each = 50))
result <- augment_survival(
data,
specification = define_survivals(
define_survival("time", formula = "-8 + 0.5 * treatment", shape = 0.3)
),
seed = 1
)
head(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.