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(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    1 0.00000000 0.48107282 0.4483028 0.9293757  5.639514
#> 2   1    1    2 0.48107282 0.64523892 0.9293757 1.0935418  5.639514
#> 3   2    0    1 0.00000000 0.08171642 1.7649768 1.8466933  3.167553
#> 4   2    1    2 0.08171642 0.64314195 1.8466933 2.4081188  3.167553
#> 5   3    0 cens 0.00000000 0.14246527 3.6832476 3.8257129  3.825713
#> 6   4    0    2 0.00000000 0.69874788 0.3152854 1.0140333  2.793439
#> 7   5    0    1 0.00000000 0.45824423 2.9096233 3.3678676  4.199572
#> 8   5    1    2 0.45824423 0.91800938 3.3678676 3.8276327  4.199572
#> 9   6    0    2 0.00000000 0.10352602 3.4787692 3.5822952  5.382354
#> 10  7    0    2 0.00000000 0.39757976 3.6934425 4.0910222  4.716016
#> 11  8    0    1 0.00000000 0.42983476 1.5536154 1.9834502  3.285288
#> 12  8    1    2 0.42983476 1.38239321 1.9834502 2.9360086  3.285288
#> 13  9    0    2 0.00000000 0.94184155 1.7032853 2.6451268  6.297958
#> 14 10    0    1 0.00000000 0.33998284 0.8629096 1.2028924 14.902135
#> 15 10    1    2 0.33998284 2.11833164 1.2028924 2.9812412 14.902135