| simulate_survival | R Documentation |
Simulate baseline data with survival outcomes
simulate_survival(
n,
specification,
covariates = NULL,
id = "id",
seed = NULL,
digits = NULL,
envir = parent.frame(),
batch = NULL
)
n |
Number of observations. |
specification |
Survival definitions from |
covariates |
Optional baseline base |
id |
Identifier name used when covariates are omitted. Defaults to
|
seed, digits, envir |
Arguments passed to |
batch |
Optional single positive whole number. When given, the
simulator runs |
A simulab_sim base data.frame with one row per simulated
subject: the identifier (or the supplied covariates) followed by one
column per event defined in specification. The survival_definitions
component holds the specification that generated it.
result <- simulate_survival(
n = 100,
specification = define_survivals(define_survival("time", formula = -8, shape = 0.3)),
seed = 1
)
head(result)
# A hazard call states the same process, with the log rate as an expression.
head(simulate_survival(
n = 100,
specification = define_survivals(time = hazard(log_rate = -8, shape = 0.3)),
seed = 1
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.