This function creates a single simulated data set for a single treatment arm. It simulates data from an illness-death model with one row per transition and subject.

getSimulatedData(
  N,
  transition = exponential_transition(h01 = 1, h02 = 1, h12 = 1),
  dropout = list(rate = 0, time = 12),
  accrual = list(param = "time", value = 0)
)

Arguments

N

(int)
number of patients.

transition

(TransitionParameters)
transition parameters comprising hazards, corresponding intervals and weibull_rates, see exponential_transition(), piecewise_exponential() and weibull_transition() for details.

dropout

(list)
specifies drop-out probability. Random censoring times are generated using exponential distribution. dropout$rate specifies the drop-out probability per dropout$time time units. If dropout$rate is equal to 0, then no censoring is applied.

accrual

(list)
specifies accrual intensity. See addStaggeredEntry() for details.

Value

This returns a data frame with one row per transition per individual.

Details

The output data set contains the following columns:

  • id (integer): patient id.

  • from (numeric): starting state of the transition.

  • to (character): final state of the transition.

  • entry (numeric): entry time of the transition on the individual time scale.

  • exit (numeric): exit time of the transition on the individual time scale.

  • entryAct (numeric): entry time of the transition on study time scale.

  • exitAct (numeric): exit time of the transition on study time scale.

  • censAct (numeric): censoring time of the individual on study time scale.

Examples

getSimulatedData(
  N = 10,
  transition = exponential_transition(h01 = 1, h02 = 1.5, h12 = 1),
  dropout = list(rate = 0.3, time = 1),
  accrual = list(param = "time", value = 5)
)
#>    id from   to     entry        exit  entryAct  exitAct   censAct
#> 1   1    0    2 0.0000000 0.001616455 2.7684671 2.770084 18.510199
#> 2   2    0    1 0.0000000 0.620109694 1.4826298 2.102739  3.915739
#> 3   2    1 cens 0.6201097 2.433109601 2.1027395 3.915739  3.915739
#> 4   3    0    2 0.0000000 0.008524979 2.2084749 2.217000  5.166295
#> 5   4    0    1 0.0000000 0.179999738 4.7083564 4.888356 11.244076
#> 6   4    1    2 0.1799997 0.693119644 4.8883562 5.401476 11.244076
#> 7   5    0    2 0.0000000 0.100762491 4.4569281 4.557691 12.757715
#> 8   6    0    2 0.0000000 0.269376008 0.7384638 1.007840  1.445770
#> 9   7    0    2 0.0000000 0.251356782 2.7693123 3.020669  8.424595
#> 10  8    0    2 0.0000000 0.895647415 4.2223962 5.118044  9.371488
#> 11  9    0    2 0.0000000 0.099131641 2.6340240 2.733156  3.494487
#> 12 10    0    1 0.0000000 0.522817343 3.7638254 4.286643  5.619036
#> 13 10    1 cens 0.5228173 1.855210094 4.2866428 5.619036  5.619036