Learn R Programming

seqDesign (version 1.0.0)

simTrial: Simulation of Multi-Arm Randomized Phase IIb/III Efficacy Trials with Time-to-Event Endpoints

Description

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.

Usage

simTrial(N, aveVE, VEmodel = c("half", "constant"), vePeriods, 
         enrollPeriod, enrollPartial, enrollPartialRelRate, 
         dropoutRate, infecRate, fuTime, visitSchedule, 
         missVaccProb = NULL, VEcutoffWeek, nTrials, stage1, 
         saveDir = NULL, randomSeed = NULL)

Arguments

N
a numeric vector specifying the numbers of enrolled trial participants per treatment arm. The length of N equals the total number of treatment arms, and the first component of N represents the control arm.
aveVE
a numeric vector containing, for each treatment arm in N, a time-averaged vaccine efficacy (VE), defined as the weighted average of VEs in the time intervals specified by vePeriods. If VEmodel = "half", VE is halved
VEmodel
a character string specifying whether VE is assumed constant over time (option "constant") or halved in the initial time interval as defined in vePeriods (option "half"). Only the first character is necessary.
vePeriods
a numeric vector defining start times (in weeks) of time intervals with (potentially) distinct VE levels depending on the choice of the VEmodel
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
enrollPartialRelRate
a non-negative value characterizing the fraction of the weekly enrollment rate governing enrollment from week 1 until week enrollPartial
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 weeks. For each component, a separate per-protocol indicator is generated. Each per-protocol cohort includes subjects
VEcutoffWeek
a time cut-off (in weeks); the follow-up time exceeding VEcutoffWeek weeks is required for inclusion in the per-protocol cohort
nTrials
the number of trials to be simulated
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 .RData file in the directory; otherwise the output is returned as a list.
randomSeed
sets seed of the random number generator for simulation reproducibility

Value

  • 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:
  • trialDataa list with nTrials components each of which is a data.frame with at least the variables trt, entry, exit, and event storing the treatment assignments, enrollment times, study exit times, and event indicators, respectively. The observed follow-up times can be recovered as exit - entry. Indicators of belonging to the per-protocol cohort (named pp1, pp2, etc.) are included if missVaccProb is specified.
  • NinfStage1a list whose components are numeric vectors with the numbers of stage1 infections by treatment ([1] = control arm) for each simulated trial
  • nTrialsthe number of simulated trials
  • Nthe total number of enrolled trial participants
  • nArmsthe number of treatment arms
  • trtAssgnProbsa numeric vector containing the treatment assignment probabilities
  • fuTimethe follow-up time (in weeks) of each participant
  • ratesa list with three components: the prior weekly enrollment rate (enrollment), the prior probability of dropout within 1 week (dropout), and the prior probability of infection within 1 week (infection)
  • enrollSchedulea data.frame summarizing information on enrollment periods and corresponding relative enrollment rates (relative to the weekly "base" enrollment rate). The column names are start, end, and relativeRates.
  • VEsa list with components being numeric vectors containing VE levels assumed within time periods defined by vePeriods for each active treatment arm
  • infecRatesa data.frame summarizing information on time periods of distinct VE across all treatment arms. The variables trt, start, end, and relRate carry treatment assignment labels, first and last week of a time interval, and the pertaining assumed hazard ratio in the given interval.
  • randomSeedthe set seed of the random number generator for simulation reproducibility

Details

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. The default block size of 10 times the number of treatment arms is used. 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.

See Also

monitorTrial, censTrial, and rankTrial

Examples

Run this code
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, 
                    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, 
###          stage1=78, saveDir="./", randomSeed=300)

Run the code above in your browser using DataLab