| completeTrial.pooledArms | R Documentation |
Considers MITT data collected through an interim timepoint and generates independent time-to-event data-sets, ignoring treatment assignments, to assess the distribution of the number of treatment arm-pooled endpoints at the end of the follow-up period. A Bayesian model for the treatment arm-pooled endpoint rate, offering the option to specify a robust mixture prior distribution, is used for generating future data (see the vignette).
completeTrial.pooledArms(
interimData,
nTrials,
N,
enrollRate = NULL,
enrollRatePeriod = NULL,
eventPriorWeight,
eventPriorRate = NULL,
fixedDropOutRate = NULL,
ppAnalysis = FALSE,
missVaccProb = NULL,
ppAtRiskTimePoint = NULL,
expectedDose2timePoint = NULL,
fuTime,
targetNevents = NULL,
mixture = FALSE,
mix.weights = NULL,
eventPriorWeightRobust = NULL,
visitSchedule,
visitSchedule2 = NULL,
saveFile = NULL,
saveDir = NULL,
saveDataChars = FALSE,
randomSeed = NULL
)
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 |
N |
the total target number of enrolled participants |
enrollRate |
a treatment arm-pooled weekly enrollment rate used for completing enrollment if fewer than |
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 value of a treatment arm-pooled prior mean incidence rate for the endpoint, expressed as the number of events per person-year at risk. If |
fixedDropOutRate |
the pre-trial assumed annual 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 ( |
expectedDose2timePoint |
a numeric value specifying the follow-up time (in weeks) at which a participant is considered expected for the second dose, i.e., when the visit window of the second vaccination visit has closed ( |
fuTime |
a follow-up time (in weeks) of each participant |
targetNevents |
an integer value specifying the target number of events in an event-driven design, the accrual of which triggers the primary analysis. The value is used exclusively for estimating the total person-time at risk accumulated for the primary analysis, which in turn is used for setting the values of the hyperparameters of the prior distribution. |
mixture |
a logical value indicating whether to use the robust mixture approach (see the vignette). If equal to |
mix.weights |
a numeric vector of length 2 representing prior weights (values in |
eventPriorWeightRobust |
a numeric value representing the weight |
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 |
saveDataChars |
a logical value ( |
randomSeed |
seed of the random number generator for simulation reproducibility |
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 with nTrials components each of which is a data.frame with the variables arm, entry, exit, event, and dropout storing the treatment assignments, enrollment times, study exit times, event indicators, and dropout indicators respectively. The observed follow-up times can be recovered as exit - entry. If ppAnalysis=TRUE, then the indicators of belonging to the per-protocol cohort (named pp) 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, if NULL, the annual treatment arm-pooled dropout rate in interimData
eventPostRate: a numeric vector of length nTrials of the treatment arm-pooled annual event rates sampled from the posterior distribution
BetaOverBetaPlusTk: the weight placed on the prior mean event rate
TkOverTstar: the ratio of the observed person-time at risk to the estimated total person-time at risk, with the event rate set equal to eventPriorRate in the estimator for the total person-time at risk
randomSeed: seed of the random number generator for simulation reproducibility
w.post: the weights, summing up to 1, of the gamma components of the posterior mixture distribution of the treatment arm-pooled event rate. If mixture=FALSE, then w.post=NA.
completeTrial.byArm
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.pooledArms(interimData=interimData, nTrials=5, N=1500,
enrollRatePeriod=24, eventPriorWeight=0.5, eventPriorRate=0.001, 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):
tmpdir <- tempfile('futility_example_'); dir.create(tmpdir)
completeTrial.pooledArms(interimData=interimData, nTrials=5, N=1500,
enrollRatePeriod=24, eventPriorWeight=0.5, eventPriorRate=0.001, fuTime=80,
visitSchedule=seq(0, 80, by=4),
visitSchedule2=c(0,seq(from=8,to=80,by=12)), saveDir=tmpdir, randomSeed=9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.