mlr_task_generators_simsurv | R Documentation |
A mlr3::TaskGenerator calling simsurv::simsurv()
from package simsurv.
This generator currently only exposes a small subset of the flexibility of simsurv, and just creates a small dataset with the following numerical covariates:
treatment
: Bernoulli distributed with hazard ratio 0.5
.
height
: Normally distributed with hazard ratio 1
.
weight
: normally distributed with hazard ratio 1
.
See simsurv::simsurv()
for an explanation of the hyperparameters.
Initial values for hyperparameters are lambdas
= 0.1, gammas
= 1.5 and maxt
= 5.
The last one, by default generates samples which are administratively censored at \tau = 5
, so increase this value if you want to change this.
This TaskGenerator can be instantiated via the dictionary mlr_task_generators or with the associated sugar function tgen()
:
mlr_task_generators$get("simsurv") tgen("simsurv")
Id | Type | Default | Levels | Range |
dist | character | weibull | weibull, exponential, gompertz | - |
lambdas | numeric | - | [0, \infty) |
|
gammas | numeric | - | [0, \infty) |
|
maxt | numeric | - | [0, \infty) |
|
mlr3::TaskGenerator
-> TaskGeneratorSimsurv
new()
Creates a new instance of this R6 class.
TaskGeneratorSimsurv$new()
help()
Opens the corresponding help page referenced by field $man
.
TaskGeneratorSimsurv$help()
clone()
The objects of this class are cloneable with this method.
TaskGeneratorSimsurv$clone(deep = FALSE)
deep
Whether to make a deep clone.
Brilleman, L. S, Wolfe, Rory, Moreno-Betancur, Margarita, Crowther, J. M (2021). “Simulating Survival Data Using the simsurv R Package.” Journal of Statistical Software, 97(3), 1–27. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/JSS.V097.I03")}.
Dictionary of TaskGenerators: mlr3::mlr_task_generators
as.data.table(mlr_task_generators)
for a table of available TaskGenerators in the running session
Other TaskGenerator:
mlr_task_generators_coxed
,
mlr_task_generators_simdens
# generate 20 samples with Weibull survival distribution
gen = tgen("simsurv")
task = gen$generate(20)
head(task)
# generate 100 samples with exponential survival distribution and tau = 40
gen = tgen("simsurv", dist = "exponential", gammas = NULL, maxt = 40)
task = gen$generate(100)
head(task)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.