Skip to contents

A mlr3::TaskGenerator calling coxed::sim.survdata().

This generator creates a survival dataset using coxed, and exposes some parameters from the sim.survdata() function. We don't include the parameters X (user-specified variables), covariate, low, high, compare, beta and hazard.fun for this generator. The latter means that no user-specified hazard function can be used and the generated datasets always use the flexible-hazard method from the package.

Dictionary

This TaskGenerator can be instantiated via the dictionary mlr_task_generators or with the associated sugar function tgen():

mlr_task_generators$get("coxed")
tgen("coxed")

Parameters

IdTypeDefaultLevelsRange
Tnumeric100\([1, \infty)\)
typecharacternonenone, tvc, tvbeta-
knotsinteger8\([1, \infty)\)
splinelogicalTRUETRUE, FALSE-
xvarsinteger3\([1, \infty)\)
muuntyped0-
sduntyped0.5-
censornumeric0.1\([0, 1]\)
censor.condlogicalFALSETRUE, FALSE-

References

Harden, J. J, Kropko, Jonathan (2019). “Simulating Duration Data for the Cox Model.” Political Science Research and Methods, 7(4), 921–928. doi:10.1017/PSRM.2018.19 .

See also

Other TaskGenerator: mlr_task_generators_simdens, mlr_task_generators_simsurv

Super class

mlr3::TaskGenerator -> TaskGeneratorCoxed

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method help()

Opens the corresponding help page referenced by field $man.

Usage

TaskGeneratorCoxed$help()


Method clone()

The objects of this class are cloneable with this method.

Usage

TaskGeneratorCoxed$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

  library(mlr3)

  # time horizon = 365 days, censoring proportion = 60%, 6 covariates normally
  # distributed with mean = 1 and sd = 2, independent censoring, no time-varying
  # effects
  gen = tgen("coxed", T = 365, type = "none", censor = 0.6, xvars = 6,
              mu = 1, sd = 2, censor.cond = FALSE)
  gen$generate(50)
#> <TaskSurv:coxed> (50 x 8)
#> * Target: y, failed
#> * Properties: -
#> * Features (6):
#>   - dbl (6): X1, X2, X3, X4, X5, X6

  # same as above, but with time-varying coefficients (counting process format)
  gen$param_set$set_values(type = "tvc")
  gen$generate(50)
#> <TaskSurv:coxed> (5319 x 10)
#> * Target: start, end, failed
#> * Properties: -
#> * Features (7):
#>   - dbl (7): X1, X2, X3, X4, X5, X6, id