Survival Task Generator for Package 'simsurv'
Source:R/TaskGeneratorSimsurv.R
mlr_task_generators_simsurv.Rd
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 data set with the following numerical covariates:
treatment
: Bernoulli distributed with log hazard ratio-0.5
.height
: Normally distributed with log hazard ratio1
.weight
: normally distributed with log hazard ratio0
.
See simsurv::simsurv()
for an explanation of the hyperparameters.
Dictionary
This TaskGenerator can be instantiated via the dictionary mlr_task_generators or with the associated sugar function tgen()
:
Super class
mlr3::TaskGenerator
-> TaskGeneratorSimsurv
Examples
if (requireNamespace("simsurv", quietly = TRUE)) {
generator = mlr3::mlr_task_generators$get("simsurv")
task = generator$generate(20)
head(task)
}
#> eventtime status height treatment weight
#> <num> <int> <num> <int> <num>
#> 1: 5.0000000 0 165.7062 1 76.61064
#> 2: 4.8158623 1 183.6046 1 79.24426
#> 3: 1.3071537 1 169.2914 0 80.40204
#> 4: 0.5505144 1 167.2785 0 81.24301
#> 5: 2.2311377 1 145.5332 0 70.01567
#> 6: 5.0000000 0 170.6549 1 92.33390