Simulate a multi-arm multi-stage design using a weighted log-rank test. Analyses can be triggered either by the cumulative number of events (combined for an active arm and the common control) or by pre-specified calendar times.
lrsim_multiarm(
M = 2,
kMax = 1,
criticalValues = NULL,
futilityBounds = NULL,
hazardRatioH0s = 1,
allocations = 1,
accrualTime = 0,
accrualIntensity = NA,
piecewiseSurvivalTime = 0,
stratumFraction = 1,
lambdas = NULL,
gammas = NULL,
n = NA,
followupTime = NA,
fixedFollowup = FALSE,
rho1 = 0,
rho2 = 0,
plannedEvents = NA,
plannedTime = NA,
maxNumberOfIterations = 1000,
maxNumberOfRawDatasetsPerStage = 0,
seed = 0,
nthreads = 0
)An S3 object of class "lrsim_seamless" with these components:
overview: A list summarizing trial-level results and settings:
overallReject: Overall probability of rejecting the null
by trial end.
overallFutility: Overall probability of stopping for futility
by trial end.
rejectPerStage: Probability of rejecting the null for each
active arm at each stage.
futilityPerStage: Probability of futility stopping for each arm
at each stage.
cumulativeRejection: Cumulative probability of rejection
for each active arm by stage.
cumulativeFutility: Cumulative probability of futility
stopping for each active arm by stage.
numberOfEvents: Cumulative event counts by stage and arm.
numberOfDropouts: Cumulative dropouts by stage and arm.
numberOfSubjects: Cumulative enrollments by stage and arm.
analysisTime: Average calendar time for each stage by arm
among replications that reached that stage.
expectedNumberOfEvents: Expected cumulative events at trial end.
expectedNumberOfDropouts: Expected cumulative dropouts at trial end.
expectedNumberOfSubjects: Expected cumulative enrollments
at trial end.
expectedStudyDuration: Expected study duration.
criticalValues: The input matrix of by-level critical boundaries.
futilityBounds: The input vector of futility boundaries.
hazardRatioH0s: The input hazard ratios under \(H_0\).
useEvents: Logical indicating whether analyses were event-driven.
numberOfIterations: Number of simulation iterations performed.
n: Planned total sample size.
allocations: The input allocation ratios.
fixedFollowup: Logical indicating whether fixed follow-up was used.
rho1, rho2: Fleming–Harrington weighting parameters used.
M: Number of active arms in Phase 2.
K: Number of sequential looks in Phase 3.
sumdata1: Data frame summarizing each iteration, stage, and
treatment group:
iterationNumber, eventsNotAchieved,
stopStage, stageNumber,
analysisTime, treatmentGroup, accruals,
events, dropouts.
For each stage the final row summarizes the overall study (all arms combined).
summdata2: Data frame summarizing log-rank statistics by iteration,
stage, and active arm:
iterationNumber, stopStage, stageNumber,
analysisTime, activeArm,
totalAccruals, totalEvents, totalDropouts,
uscore, vscore, logRankStatistic,
reject, futility.
For each active arm, total accruals, events, and dropouts refer to the combined counts for that arm and the common control at that stage.
rawdata (present when maxNumberOfRawDatasetsPerStage > 0):
Subject-level data for selected replications with variables:
iterationNumber, stopStage, stageNumber,
analysisTime, subjectId, arrivalTime,
stratum, treatmentGroup,
survivalTime, dropoutTime, timeUnderObservation,
event, dropoutEvent.
Number of active treatment arms.
Number of sequential looks.
Numeric matrix of dimension \(kMax \times M\) giving the by-look critical values for the closed testing procedure. The first column is used for the level-M test and the last column for the level-1 test.
Numeric vector of length \(kMax - 1\) giving the futility boundaries on the Wald-statistic scale for the first \(kMax - 1\) looks. At an interim look, the study stops for futility if all active treatment arms fall below the futility boundary. If omitted, no interim futility stopping is applied.
Scalar or numeric vector of length \(M\). Hazard ratios under \(H_0\) for each active arm versus the common control. Defaults to 1 for superiority tests.
Integer or integer vector of length \(M + 1\). Number of subjects per arm within a randomization block. A single value implies equal allocation; defaults to 1. The first \(M\) elements refer to the active arms and the last element refers to the common control.
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
c(0, 3) breaks the time axis into 2 accrual intervals:
\([0, 3)\) and \([3, \infty)\).
A vector of accrual intensities. One for each accrual time interval.
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
c(0, 6) breaks the time axis into 2 event intervals:
\([0, 6)\) and \([6, \infty)\).
Defaults to 0 for exponential distribution.
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification.
List of length \(M + 1\) (one element per arm). Each element is a scalar or a numeric vector of event hazard rates for the corresponding arm, given by analysis interval and stratum as required by the simulation. The first \(M\) elements refer to the active arms and the last element refers to the common control.
List of length \(M + 1\) (one element per arm). Each element is a scalar or a numeric vector of dropout hazard rates for the corresponding arm, by analysis interval and stratum. The first \(M\) elements refer to the active arms and the last element refers to the common control.
Planned total sample size across all active arms and control.
Follow-up time for the last enrolled subject.
Whether a fixed follow-up design is used.
Defaults to FALSE for variable follow-up.
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test.
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test.
Numeric vector of length \(K + 1\) giving the
planned cumulative number of events to trigger Look 1 through Look
\(K + 1\). Each entry refers to the combined events for the first
active arm and the common control. Use plannedEvents to schedule
event-driven looks.
Numeric vector of calendar times for the analyses.
If plannedTime is supplied, analyses are scheduled by calendar
time and plannedEvents should be left missing.
Number of Monte Carlo replications. Defaults to 1000.
Number of subject-level raw datasets to retain per stage (for selected replications).
Random seed for reproducibility.
Number of threads for parallel simulation. Use 0 to accept the default RcppParallel behavior.
Kaifeng Lu, kaifenglu@gmail.com
(sim1 <- lrsim_multiarm(
M = 2,
kMax = 3,
criticalValues = matrix(c(3.880, 2.747, 2.275,
3.710, 2.511, 1.993), 3, 2),
futilityBounds = c(0.074, 1.207),
accrualTime = c(0, 8),
accrualIntensity = c(10, 28),
piecewiseSurvivalTime = 0,
lambdas = list(log(2)/12*0.5, log(2)/12*0.75, log(2)/12),
n = 700,
plannedEvents = c(36, 72, 108),
maxNumberOfIterations = 10000,
maxNumberOfRawDatasetsPerStage = 1,
seed = 314159,
nthreads = 1))
Run the code above in your browser using DataLab