`simTrial`

generates independent time-to-event data-sets according to a user-specified trial design. The user makes assumptions about the enrollment, dropout, and infection processes in each treatment arm.

1 2 3 4 5 |

`N` |
a numeric vector specifying the numbers of enrolled trial participants per treatment arm. The length of |

`aveVE` |
a numeric vector containing, for each treatment arm in |

`VEmodel` |
a character string specifying whether VE is assumed constant over time (option " |

`vePeriods` |
a numeric vector defining start times (in weeks) of time intervals with (potentially) distinct VE levels depending on the choice of the |

`enrollPeriod` |
the final week of the enrollment period |

`enrollPartial` |
the final week of the portion of the enrollment period with a reduced enrollment rate defined by |

`enrollPartialRelRate` |
a non-negative value characterizing the fraction of the weekly enrollment rate governing enrollment from week 1 until week |

`dropoutRate` |
a (prior) annual dropout rate |

`infecRate` |
a (prior) annual infection rate in the control arm |

`fuTime` |
a follow-up time (in weeks) of each participant |

`visitSchedule` |
a numeric vector listing the visit weeks at which testing for the endpoint is conducted |

`missVaccProb` |
a numeric vector with conditional probabilities of having missed a vaccination given the follow-up time exceeds |

`VEcutoffWeek` |
a time cut-off (in weeks); the follow-up time exceeding |

`nTrials` |
the number of trials to be simulated |

`blockSize` |
a constant block size to be used in permuted-block randomization. The choice of |

`stage1` |
the final week of stage 1 in a two-stage trial |

`saveDir` |
a character string specifying a path for the output directory. If supplied, the output is saved as an |

`verbose` |
a logical value indicating whether information on the output directory and file name should be printed out (default is |

`randomSeed` |
sets seed of the random number generator for simulation reproducibility |

All time variables use week as the unit of time. Month is defined as 52/12 weeks.

The prior weekly enrollment rate is calculated based on the duration of the enrollment periods with reduced/full enrollment rates and the total number of subjects to be enrolled.

The weekly enrollment, dropout and infection rates used for generating trial data are sampled from specified prior distributions (the prior annual dropout and infection probabilities are specified by the user). The default choice considers non-random point-mass distributions, i.e., the prior rates directly govern the accumulation of trial data.

Subjects' enrollment is assumed to follow a Poisson process with a time-varying rate (the argument `enrollPartialRelRate`

characterizes a reduced enrollment rate applied to weeks 1 through `enrollPartial`

, i.e., full enrollment starts at week `enrollPartial`

+1). The number of enrolled subjects is determined by the vector `N`

.

Dropout times are assumed to follow an exponential distribution where the probability of a dropout within 1 week is equal to `dropoutRate`

/52.

Permuted-block randomization is used for assigning treatment labels. If left unspecified by the user, an appropriate block size, no smaller than 10, will computed and used. The function `getBlockSize`

can be used to determine appropriate block sizes (see help(getBlockSize)).

Infection times are generated following the VE schedule characterized by `aveVE`

, `VEmodel`

and `vePeriods`

. Independent exponential times are generated within each time period of constant VE, and their minimum specifies the right-censored infection time. Exponential rates are chosen that satisfy the user-specified requirements on the treatment- and time-period-specific probabilities of an infection within 1 week (in the control arm, the infection probability within 1 week uniformly equals `infecRate`

/52).

Infection diagnosis times are calculated according to the `visitSchedule`

. The observed follow-up time is defined as the minumum of the infection diagnosis time, dropout time, and `fuTime`

.

If `saveDir`

is specified, the output list (named `trialObj`

) is saved as an `.RData`

file (the output directory path is printed); otherwise it is returned. The output object is a list with the following components:

`trialData` |
a list with |

`NinfStage1` |
a list whose components are numeric vectors with the numbers of |

`nTrials` |
the number of simulated trials |

`N` |
the total number of enrolled trial participants |

`nArms` |
the number of treatment arms |

`trtAssgnProbs` |
a numeric vector containing the treatment assignment probabilities |

`blockSize` |
the block size used for treatment assignment |

`fuTime` |
the follow-up time (in weeks) of each participant |

`rates` |
a list with three components: the prior weekly enrollment rate ( |

`enrollSchedule` |
a |

`VEs` |
a list with components being numeric vectors containing VE levels assumed within time periods defined by |

`infecRates` |
a |

`randomSeed` |
the set seed of the random number generator for simulation reproducibility |

`monitorTrial`

, `censTrial`

, and `rankTrial`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
simData <- simTrial(N=c(1000, rep(700, 2)), aveVE=seq(0, 0.4, by=0.2),
VEmodel="half", vePeriods=c(1, 27, 79), enrollPeriod=78,
enrollPartial=13, enrollPartialRelRate=0.5, dropoutRate=0.05,
infecRate=0.04, fuTime=156,
visitSchedule=c(0, (13/3)*(1:4), seq(13*6/3, 156, by=13*2/3)),
missVaccProb=c(0,0.05,0.1,0.15), VEcutoffWeek=26, nTrials=5,
blockSize=30, stage1=78, randomSeed=300)
### alternatively, to save the .RData output file (no '<-' needed):
###
### simTrial(N=c(1400, rep(1000, 2)), aveVE=seq(0, 0.4, by=0.2), VEmodel="half",
### vePeriods=c(1, 27, 79), enrollPeriod=78, enrollPartial=13,
### enrollPartialRelRate=0.5, dropoutRate=0.05, infecRate=0.04, fuTime=156,
### visitSchedule=c(0, (13/3)*(1:4), seq(13*6/3, 156, by=13*2/3)),
### missVaccProb=c(0,0.05,0.1,0.15), VEcutoffWeek=26, nTrials=30,
### blockSize=30, stage1=78, saveDir="./", randomSeed=300)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.