simTrial {seqDesign} | R Documentation |
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, blockSize = NULL, stage1, saveFile = NULL, saveDir = NULL,
verbose = TRUE, randomSeed = NULL)
Arguments
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 |
saveFile |
a character string specifying the name of the output |
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 |
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 withnTrials
components each of which is adata.frame
with at least the variablestrt
,entry
,exit
, andevent
storing the treatment assignments, enrollment times, study exit times, and event indicators, respectively. The observed follow-up times can be recovered asexit
-entry
. Indicators of belonging to the per-protocol cohort (namedpp1
,pp2
, etc.) are included ifmissVaccProb
is specified. -
NinfStage1
: a list whose components are numeric vectors with the numbers ofstage1
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
: adata.frame
summarizing information on enrollment periods and corresponding relative enrollment rates (relative to the weekly "base" enrollment rate). The column names arestart
,end
, andrelativeRates
. -
VEs
: a list with components being numeric vectors containing VE levels assumed within time periods defined byvePeriods
for each active treatment arm -
infecRates
: adata.frame
summarizing information on time periods of distinct VE across all treatment arms. The variablestrt
,start
,end
, andrelRate
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
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=5,
### blockSize=30, stage1=78, saveDir="./", randomSeed=300)