This function adds staggered study entry times to a simulated data set with illness-death model structure.

addStaggeredEntry(simData, N, accrualParam, accrualValue)

Arguments

simData

(data.frame)
simulated data frame containing entry and exit times at individual study time scale. See getSimulatedData() for details.

N

(int)
number of patients.

accrualParam

(string)
possible values are 'time' or 'intensity'.

accrualValue

(number)
specifies the accrual intensity. For accrualParam equal time, it describes the length of the accrual period. For accrualParam equal intensity, it describes the number of patients recruited per time unit. If accrualValue is equal to 0, all patients start at calendar time 0 in the initial state.

Value

This returns a data set containing a single simulated study containing accrual times, i.e. staggered study entry. This is a helper function of getSimulatedData().

Examples

simData <- data.frame(
  id = c(1, 1, 2, 3), from = c(0, 1, 0, 0), to = c(1, 2, "cens", 2),
  entry = c(0, 3, 0, 0),
  exit = c(3, 5.3, 5.6, 7.2), censTime = c(6.8, 6.8, 5.6, 9.4)
)
addStaggeredEntry(simData, 3, accrualParam = "time", accrualValue = 5)
#>   id from   to entry exit  entryAct  exitAct  censAct
#> 1  1    0    1     0  3.0 0.5129818 3.512982 7.312982
#> 2  1    1    2     3  5.3 3.5129818 5.812982 7.312982
#> 3  2    0 cens     0  5.6 1.1853786 6.785379 6.785379
#> 4  3    0    2     0  7.2 0.1154988 7.315499 9.515499