Survival Task Generator for Package 'coxed'
Source:R/TaskGeneratorCoxed.R
mlr_task_generators_coxed.Rd
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()
:
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 | - |
See also
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
Super class
mlr3::TaskGenerator
-> TaskGeneratorCoxed
Examples
if (requireNamespace("coxed", quietly = TRUE)) {
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)
}
#> <TaskSurv:coxed> (4038 x 10)
#> * Target: start, end, failed
#> * Properties: -
#> * Features (7):
#> - dbl (7): X1, X2, X3, X4, X5, X6, id