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

1
2
3
4
5
simTrial(N, aveVE, VEmodel = c("half", "constant"), vePeriods, 
         enrollPeriod, enrollPartial, enrollPartialRelRate, 
         dropoutRate, infecRate, fuTime, visitSchedule, 
         missVaccProb = NULL, VEcutoffWeek, nTrials, blockSize = NULL,
         stage1, saveDir = NULL, verbose = TRUE, 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 in the initial interval, the full VE is applied in the second interval, and aveVE is applied thereafter. The components of N and aveVE correspond to each other.

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 with (i) a non-missing vaccination, and (ii) follow-up time exceeding VEcutoffWeek weeks. If NULL, no per-protocol indicators are included.

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

blockSize

a constant block size to be used in permuted-block randomization. The choice of blockSize requires caution to achieve the desired balance of treatment assignments within a block.

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.

verbose

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

randomSeed

sets 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. 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.

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:

trialData

a 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.

NinfStage1

a list whose components are numeric vectors with the numbers of stage1 infections by treatment ([1] = control arm) for each simulated trial

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 (enrollment), the prior probability of dropout within 1 week (dropout), and the prior probability of infection within 1 week (infection)

enrollSchedule

a 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.

VEs

a list with components being numeric vectors containing VE levels assumed within time periods defined by vePeriods for each active treatment arm

infecRates

a 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.

randomSeed

the set seed of the random number generator for simulation reproducibility

See Also

monitorTrial, censTrial, and rankTrial

Examples

 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)