mlr_task_generators_coxed: Survival Task Generator for Package 'coxed'

mlr_task_generators_coxedR Documentation

Survival Task Generator for Package 'coxed'

Description

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

Id Type Default Levels Range
T numeric 100 [1, \infty)
type character none none, tvc, tvbeta -
knots integer 8 [1, \infty)
spline logical TRUE TRUE, FALSE -
xvars integer 3 [1, \infty)
mu untyped 0 -
sd untyped 0.5 -
censor numeric 0.1 [0, 1]
censor.cond logical FALSE TRUE, FALSE -

Super class

mlr3::TaskGenerator -> TaskGeneratorCoxed

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
TaskGeneratorCoxed$new()

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.

References

Harden, J. J, Kropko, Jonathan (2019). “Simulating Duration Data for the Cox Model.” Political Science Research and Methods, 7(4), 921–928. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1017/PSRM.2018.19")}.

See Also

  • 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_simdens, mlr_task_generators_simsurv

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)

  # same as above, but with time-varying coefficients (counting process format)
  gen$param_set$set_values(type = "tvc")
  gen$generate(50)


mlr-org/mlr3proba documentation built on April 12, 2025, 4:38 p.m.