completeTrial.byArm {futility} | R Documentation |
Treatment Arm-Specific Simulation-Based Completion of a Randomized Efficacy Trial with a Time-to-Event Endpoint and Fixed Follow-up Using an Interim Data-set
Description
Considers MITT data collected through an interim timepoint and generates independent time-to-event data-sets, by treatment arm, to assess the distribution of the number of treatment arm-specific endpoints at the end of the follow-up period. A Bayesian model for treatment arm-specific endpoint rates is used for generating future data (see the vignette).
Usage
completeTrial.byArm(interimData, nTrials, trtNames, N, enrollRate = NULL,
enrollRatePeriod, eventPriorWeight, eventPriorRate,
fixedDropOutRate = NULL, ppAnalysis = FALSE, missVaccProb = NULL,
ppAtRiskTimePoint = NULL, fuTime, visitSchedule,
visitSchedule2 = NULL, saveFile = NULL, saveDir = NULL,
randomSeed = NULL)
Arguments
interimData |
a data frame capturing observed MITT data at an interim timepoint that contains one row per enrolled participant in the MITT cohort and the following variables: |
nTrials |
the number of trials to be simulated |
trtNames |
a character vector of treatment labels as specified in |
N |
a numeric vector specifying the target number of enrolled participants in each treatment arm, with the arms in the same order as in |
enrollRate |
a treatment arm-pooled weekly enrollment rate used for completing enrollment if |
enrollRatePeriod |
the length (in weeks) of the time period preceding the time of the last enrolled participant in |
eventPriorWeight |
a numeric value in |
eventPriorRate |
a numeric vector of treatment arm-specific prior mean incidence rates for the endpoint, expressed as numbers of events per person-year at risk, with the arms in the same order as in |
fixedDropOutRate |
the pre-trial assumed annual treatment arm-pooled dropout rate. If |
ppAnalysis |
a logical value ( |
missVaccProb |
a probability that a participant misses at least one vaccination. If |
ppAtRiskTimePoint |
a minimal follow-up time (in weeks) for a participant to qualify for inclusion in the per-protocol cohort ( |
fuTime |
a follow-up time (in weeks) of each participant |
visitSchedule |
a numeric vector of visit weeks at which testing for the endpoint is conducted |
visitSchedule2 |
a numeric vector of visit weeks at which testing for the endpoint is conducted in a subset of participants (e.g., those who discontinue administration of the study product but remain in follow-up). If |
saveFile |
a character string specifying an |
saveDir |
a character string specifying a path for the output directory. If supplied, the output is saved as an |
randomSeed |
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; 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 the variablesarm
,entry
,exit
,event
, anddropout
storing the treatment assignments, enrollment times, study exit times, event indicators, and dropout indicators, respectively. The observed follow-up times can be recovered asexit
-entry
. IfppAnalysis=TRUE
, then the indicators of belonging to the per-protocol cohort (namedpp
) are included. -
nTrials
: the number of simulated trials -
N
: the total number of enrolled trial participants -
rates
: a list with three components:-
enrollRate
: the treatment arm-pooled weekly enrollment rate -
dropRate
:fixedDropOutRate
, or, ifNULL
, the annual treatment arm-pooled dropout rate ininterimData
-
eventPostRate
: a list withlength(trtNames)
components (labeled by the levels of thearm
variable ininterimData
) each of which is a numeric vector of lengthnTrials
of the sampled treatment arm-specific posterior annual event rates
-
-
BetaOverBetaPlusTk
: a list withlength(trtNames)
components (labeled by the levels of thearm
variable ininterimData
) each of which is the arm-specific weight placed on the prior mean event rate -
TkOverTstar
: a list withlength(trtNames)
components (labeled by the levels of thearm
variable ininterimData
) each of which is the ratio of the observed arm-specific person-time at risk to the estimated total arm-specific person-time at risk, with the arm-specific event rates set equal to the components ofeventPriorRate
in the estimator for the total arm-specific person-time at risk -
randomSeed
: seed of the random number generator for simulation reproducibility
See Also
Examples
arm <- rep(c("C3","T1","T2"), each=250)
schedule <- rbinom(length(arm), 1, 0.01)
entry <- rpois(length(arm), lambda=60)
entry <- entry - min(entry)
last_visit_dt <- entry + runif(length(arm), min=0, max=80)
event <- rbinom(length(arm), 1, 0.01)
dropout <- rbinom(length(arm), 1, 0.02)
dropout[event==1] <- 0
exit <- rep(NA, length(arm))
exit[event==1] <- last_visit_dt[event==1] + 5
exit[dropout==1] <- last_visit_dt[dropout==1] + 5
followup <- ifelse(event==1 | dropout==1, 0, 1)
interimData <- data.frame(arm=arm, schedule2=schedule, entry=entry, exit=exit,
last_visit_dt=last_visit_dt, event=event, dropout=dropout, complete=0, followup=followup)
completeData <- completeTrial.byArm(interimData=interimData, nTrials=5,
trtNames=c("C3","T1","T2"), N=c(500,500,500), enrollRatePeriod=24, eventPriorWeight=0.5,
eventPriorRate=c(0.001,0.0004,0.0004), fuTime=80, visitSchedule=seq(0, 80, by=4),
visitSchedule2=c(0,seq(from=8,to=80,by=12)), randomSeed=9)
### alternatively, to save the .RData output file (no '<-' needed):
completeTrial.byArm(interimData=interimData, nTrials=5, trtNames=c("C3","T1","T2"),
N=c(500,500,500), enrollRatePeriod=24, eventPriorWeight=0.5,
eventPriorRate=c(0.001,0.0004,0.0004), fuTime=80, visitSchedule=seq(0, 80, by=4),
visitSchedule2=c(0,seq(from=8,to=80,by=12)), saveDir="./", randomSeed=9)