Skip to contents

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 ratio 1.

  • weight: normally distributed with log hazard ratio 0.

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():

mlr_task_generators$get("simsurv")
tgen("simsurv")

Super class

mlr3::TaskGenerator -> TaskGeneratorSimsurv

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

TaskGeneratorSimsurv$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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