packageVersion("rpact")[1] '5.0.0'
rpact] to plan enrichment trials with time-to-event endpoints allows comparing interim population-selection strategies and assessing power, event targets, recruitment, and trial duration across treatment-effect scenarios.
An adaptive enrichment trial can begin recruiting from the full eligible population and use interim data to decide whether to focus subsequent recruitment on a prespecified subgroup. For a time-to-event endpoint, the design must account for when enough events are observed to make that decision and how restricting recruitment affects the patients and events available for the next analysis.
The patient-wise simulation option in getSimulationEnrichmentSurvival() generates individual accrual, event and drop-out times under the specified recruitment schedule and patient cap. It lets us assess which population is selected, whether selection occurs while recruitment is still open, and how often the trial reaches its event targets. We can also estimate rejection probabilities, the number of patients randomized, and trial duration.
We use a hypothetical time-to-progression trial with one experimental treatment and one control. We first assess a single-stage design that tests the biomarker-positive and full populations. We then compare two strategies in a two-stage design, retaining both populations or selecting one at interim. The biomarker-positive subgroup makes up 40% of the initially eligible population, recruitment is capped at 400 patients, and the two-stage design plans analyses after 50 and 100 events.
Patient-wise simulation also supports the standard effectList specification using subgroup event probabilities and hazard ratios. Here we use piecewise exponential event times so that treatment benefit can begin after six months in one subgroup. The examples require at least rpact 5.0, which comes with support for the median arguments. We use here version:
Let’s start with a fixed design example.
For the two-population setting, rpact uses the subgroup names S and R. They describe disjoint parts of the initially eligible population:
| Symbol | Meaning | Initial prevalence |
|---|---|---|
S |
Subgroup of biomarker-positive patients | 0.40 |
R |
Remaining patients, the complement of S |
0.60 |
F |
Full population, union of S and R |
1.00 |
The two efficacy hypotheses concern S and F. R supplies the information about patients outside S; it is not an additional separately tested population in this setting. The hypotheses overlap because patients in S also belong to F.
This distinction determines the input structure. The control-hazard and treatment-effect matrices have rows for the disjoint groups S and R, not for the tested populations S and F. We therefore do not add a row for F, because this would be redundant and possibly conflicting input.
Both S and R contain experimental-treatment and control patients. In particular, R is not the control arm. As usual in rpact, treatment group 1 is experimental treatment and treatment group 2 is control. Here, each biomarker group contains patients from both treatment groups.
We initially recruit both subgroups and randomize patients 1:1 to experimental treatment and control. Here is an overview of our trial assumptions:
| Assumption | Value |
|---|---|
| Endpoint | Time to disease progression |
Control median in S |
25 months |
Control median in R |
18 months |
Treatment effect in S |
HR 1 during the first six months, then HR 0.50 (delayed effect) |
Treatment effect in R |
HR 1 throughout (no effect) |
| Initial subgroup prevalences | 40% S, 60% R |
| Recruitment | 20 randomized patients per month for up to 20 months |
| Maximum number randomized | 400 patients across treatment and control |
| Drop-out probability within 12 months | 5% in each treatment group |
| Single-stage analysis | After 100 events across the full population |
| Testing | One-sided level 0.025, stratified analysis, Spiessens-Debois intersection test |
The control medians differ between subgroups because the biomarker is assumed to be prognostic, too. As we can see from the different hazard ratios in the treatment groups, the biomarker is also predictive of treatment benefit.
The model allows baseline prognosis and treatment benefit to differ by subgroup. In this example, the control hazard is constant within each subgroup, and the treatment hazard changes at month six in S to represent delayed benefit.
Let’s have a look how we can enter these assumptions in rpact.
The intervals start at 0 and 6 months since each patient’s study entry: \([0,6)\) and \([6,\infty)\). They do not refer to calendar recruitment periods. The second interval is open-ended.
lambdaControls is a subgroup-by-interval matrix. Unlike the multi-arm specification, which has one common control-hazard vector, an enrichment specification permits a different control-hazard profile in each disjoint subgroup. The hazardRatio matrix must have the same structure. (Reordering one input without reordering the others would change which assumptions belong to which patients.) We then supply these together to the getPiecewiseSurvivalTimeEnrichment() function:
subGroups <- c("S", "R")
prevalences <- c(0.40, 0.60)
intervalStarts <- c(0, 6)
lambdaControls <- rbind(
S = rep(getLambdaByMedian(25), length(intervalStarts)),
R = rep(getLambdaByMedian(18), length(intervalStarts))
)
hazardRatio <- rbind(
S = c(1, 0.50),
R = c(1, 1)
)
piecewiseLambda <- getPiecewiseSurvivalTimeEnrichment(
piecewiseSurvivalTime = intervalStarts,
lambdaControls = lambdaControls,
hazardRatio = hazardRatio
)
piecewiseLambdaPiecewise exponential enrichment survival time
Control hazards
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.0277 | 0.0385 |
| >=6 | 0.0277 | 0.0385 |
Details
User defined parameters
Control hazards
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.0277 | 0.0385 |
| >=6 | 0.0277 | 0.0385 |
Hazard ratios - Situation 1
| Interval | S | R |
|---|---|---|
| 0 - <6 | 1.000 | 1.000 |
| >=6 | 0.500 | 1.000 |
Generated parameters
Treatment hazards are calculated within each subgroup \(g\) and interval \(j\) as \(\lambda_{T,g,j} = HR_{g,j}\lambda_{C,g,j}\) where \(C\) denotes the control group and \(T\) denotes the treatment group. The resulting long-form table makes the assignment explicit:
| Subgroup | Interval | Control hazard | Hazard ratio | Treatment hazard |
|---|---|---|---|---|
| S | 0 - <6 | 0.0277 | 1.0 | 0.0277 |
| R | 0 - <6 | 0.0385 | 1.0 | 0.0385 |
| S | >=6 | 0.0277 | 0.5 | 0.0139 |
| R | >=6 | 0.0385 | 1.0 | 0.0385 |
There is one value per subgroup and interval. Values are not automatically recycled, and all hazards and hazard ratios must be finite and strictly positive. In this example the control hazards are constant within each subgroup, but different control hazards could also be specified for the two intervals.
For an exponential distribution with rate parameter \(\lambda\), the median is \(m = \log(2)/\lambda\). Within the same subgroup and interval, the hazard ratio \(HR = \lambda_T/\lambda_C = m_C/m_T\). So for example if the control median is 25 months and the hazard ratio is 0.50, the treatment median is \(25 / 0.50 = 50\) months.
In rpact an alternative to specifying hazards and hazard ratios is to specify medians for the control and treatment groups directly. The median matrices follow the same subgroup, interval, and naming rules as their hazard counterparts:
medianControls <- rbind(
S = c(25, 25),
R = c(18, 18)
)
medianTreatments <- rbind(
S = c(25, 25 / 0.50),
R = c(18, 18)
)
piecewiseMedian <- getPiecewiseSurvivalTimeEnrichment(
piecewiseSurvivalTime = intervalStarts,
medianControls = medianControls,
medianTreatments = medianTreatments
)
piecewiseMedianPiecewise exponential enrichment survival time
Control hazards
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.0277 | 0.0385 |
| >=6 | 0.0277 | 0.0385 |
Details
User defined parameters
Control medians (exponential per interval)
| Interval | S | R |
|---|---|---|
| 0 - <6 | 25.000 | 18.000 |
| >=6 | 25.000 | 18.000 |
Treatment medians - Situation 1 (exponential per interval)
| Interval | S | R |
|---|---|---|
| 0 - <6 | 25.000 | 18.000 |
| >=6 | 50.000 | 18.000 |
Generated parameters
Control hazards
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.0277 | 0.0385 |
| >=6 | 0.0277 | 0.0385 |
Hazard ratios - Situation 1
| Interval | S | R |
|---|---|---|
| 0 - <6 | 1.000 | 1.000 |
| >=6 | 0.500 | 1.000 |
The constructor internally converts medians with getLambdaByMedian(). The input medians remain user-defined parameters; calculated hazards and hazard ratios are marked as derived. The two specifications describe the same distributions up to numerical rounding:
[1] TRUE
The control and treatment input choices are independent with regards to the use of hazards versus medians. Both of these calls describe the same model:
piecewiseMixed1 <- getPiecewiseSurvivalTimeEnrichment(
piecewiseSurvivalTime = intervalStarts,
medianControls = medianControls,
hazardRatio = hazardRatio
)
piecewiseMixed2 <- getPiecewiseSurvivalTimeEnrichment(
piecewiseSurvivalTime = intervalStarts,
lambdaControls = lambdaControls,
medianTreatments = medianTreatments
)In other words, we need to specify exactly one of lambdaControls and medianControls, and exactly one of hazardRatio and medianTreatments.
Please keep in mind that these interval medians describe the exponential distribution corresponding to that interval’s hazard. They are not, in general, the actual medians from study entry. In S, treatment has the control hazard for six months and only then changes to the hazard corresponding to an exponential median of 50 months. Its actual combined overall median is thus \(6 + (25 - 6)/0.50 = 44\) months.
There is a second distinction in enrichment planning: the full population is a mixture of subgroups. Before selection, its survival function is
\[ S_{F,a}(t) = 0.40 S_{S,a}(t) + 0.60 S_{R,a}(t), \]
where \(a\) denotes treatment \(T\) or control \(C\), and \(S\) and \(R\) denote the subgroups as above. The overall median of this mixture is not the prevalence-weighted average of the subgroup medians. Nor can a full-population HR be calculated by taking a prevalence-weighted average of the subgroup HRs. The reason is the so-called non-collapsibility of the hazard ratio (Bian et al. 2024).
The full-population analysis below is a stratified log-rank analysis, not an analysis based on an assumed single marginal HR. We use ggplot2 to plot the theoretical curves for the two subgroups and their initial full-population mixture:
survivalProbability <- function(time, hazards) {
1 - getPiecewiseExponentialDistribution(
time = time,
piecewiseSurvivalTime = intervalStarts,
piecewiseLambda = hazards
)
}
timeGrid <- seq(0, 60, by = 0.25)
nGrid <- length(timeGrid)
treatmentHazards <- piecewiseLambda$getActiveHazards()[, , 1]
controlSurvival <- vapply(seq_along(subGroups), function(group) {
survivalProbability(timeGrid, lambdaControls[group, ])
}, numeric(nGrid))
treatmentSurvival <- vapply(seq_along(subGroups), function(group) {
survivalProbability(timeGrid, treatmentHazards[group, ])
}, numeric(nGrid))
controlSurvival <- cbind(controlSurvival, F = as.vector(controlSurvival %*% prevalences))
treatmentSurvival <- cbind(treatmentSurvival, F = as.vector(treatmentSurvival %*% prevalences))
populationLabels <- c("S", "R", "F")
survivalCurves <- do.call(rbind, lapply(seq_along(populationLabels), function(group) {
data.frame(
time = rep(timeGrid, 2),
survival = c(treatmentSurvival[, group], controlSurvival[, group]),
arm = rep(c("Treatment", "Control"), each = length(timeGrid)),
population = populationLabels[group]
)
}))
survivalCurves$population <- factor(survivalCurves$population, levels = populationLabels)
survivalCurves$arm <- factor(survivalCurves$arm, levels = c("Treatment", "Control"))
ggplot(survivalCurves, aes(time, survival, colour = arm)) +
geom_line(linewidth = 0.9) +
geom_vline(xintercept = 6, linetype = "dashed", colour = "grey50") +
facet_wrap(~population, nrow = 1) +
scale_colour_manual(values = c(Treatment = "#0072B2", Control = "#666666")) +
scale_x_continuous(breaks = c(0, 30, 60)) +
labs(x = "Months since study entry",
y = "Probability of no progression", colour = "Arm") +
theme_minimal() +
theme(legend.position = "bottom")
These survival curves describe the planning distributions before population selection. The actual subgroup medians can be obtained with getPiecewiseExponentialQuantile(). For F, we use root finding to determine the time at which the weighted survival probabilities equal 0.5:
subgroupMedians <- function(hazards) {
vapply(seq_along(subGroups), function(group) {
getPiecewiseExponentialQuantile(
quantile = 0.5,
piecewiseSurvivalTime = intervalStarts,
piecewiseLambda = hazards[group, ]
)
}, numeric(1))
}
fullPopulationMedian <- function(hazards) {
uniroot(function(time) {
survival <- vapply(seq_along(subGroups), function(group) {
survivalProbability(time, hazards[group, ])
}, numeric(1))
return(sum(prevalences * survival) - 0.5)
}, interval = c(0, 200))$root
}
overallMedians <- data.frame(
Population = populationLabels,
Control = c(subgroupMedians(lambdaControls), fullPopulationMedian(lambdaControls)),
Treatment = c(subgroupMedians(treatmentHazards), fullPopulationMedian(treatmentHazards))
)
knitr::kable(overallMedians, digits = 2,
col.names = c("Population", "Actual control median (months)",
"Actual treatment median (months)")
)| Population | Actual control median (months) | Actual treatment median (months) |
|---|---|---|
| S | 25.00 | 44.00 |
| R | 18.00 | 18.00 |
| F | 20.44 | 24.16 |
We start with placing the survival object inside effectList alongside the subgroup names and prevalences, thus capturing the complete specification of the subgroup survival assumptions:
The simulation then combines the subgroup survival assumptions in effectList with the design, accrual schedule, drop-out assumptions, patient cap, and event target.
We use the patient-wise C++ engine with simulationType = "patientWise" and explicitly select a stratified analysis with stratifiedAnalysis = TRUE. The Spiessens-Debois intersection test accounts for the overlapping populations in this two-population closed testing procedure:
maxNumberOfIterations <- 5000
designFixed <- getDesignFixed(alpha = 0.025, sided = 1)
simulationFixed <- getSimulationEnrichmentSurvival(
design = designFixed,
effectList = effectList,
simulationType = "patientWise",
directionUpper = FALSE,
intersectionTest = "SpiessensDebois",
stratifiedAnalysis = TRUE,
typeOfSelection = "all",
plannedEvents = 100,
allocationRatioPlanned = 1,
accrualTime = c(0, 20),
accrualIntensity = 20,
accrualIntensityType = "absolute",
maxNumberOfSubjects = 400,
dropoutRate1 = 0.05,
dropoutRate2 = 0.05,
dropoutTime = 12,
maxNumberOfIterations = maxNumberOfIterations,
seed = 1234
)
summary(simulationFixed)Simulation of a survival endpoint (enrichment design)
Fixed sample analysis, one-sided significance level 2.5%. The results were obtained using patient-level simulation for a population enrichment logrank test (treatment vs. control, 2 populations), H0: hazard ratio = 1, power directed towards smaller values, H1: piecewise exponential survival distribution with interval start times = c(0, 6) (last interval open-ended), control hazards (S) = c(0.0277, 0.0277), control hazards (R) = c(0.0385, 0.0385), hazard ratios for Situation 1 (in interval order): S = c(1, 0.5); R = c(1, 1), subgroups = c(S, R), prevalences = c(0.4, 0.6), planned events = 100, number of subjects = 400, accrual time = c(0, 20), dropout rate(1) = 0.05, dropout rate(2) = 0.05, dropout time = 12, intersection test = SpiessensDebois, success criterion: all, simulation runs = 5000, seed = 1234.
| Stage | Fixed |
|---|---|
| Stage level (one-sided) | 0.0250 |
| Efficacy boundary (z-value scale) | 1.960 |
| Reject at least one | 0.0822 |
| Rejected populations | |
| Subpopulation S | 0.0662 |
| Full population F | 0.0372 |
| Success per stage | 0.0212 |
| Number of subjects | 387.6 |
| Number of events per population | |
| Subpopulation S | 31.4 |
| Full population F | 100.0 |
| Selected populations | |
| Subpopulation S | 1.0000 |
| Full population F | 1.0000 |
| Number of populations | 2.000 |
| Analysis time | 19.60 |
| Expected study duration | 19.60 |
| Observed drop-out proportion (1) | |
| Subpopulation S | 0.0357 |
| Full population F | 0.0341 |
| Observed drop-out proportion (2) | |
| Subpopulation S | 0.0344 |
| Full population F | 0.0332 |
Legend:
Drop-out times are simulated independently from an exponential distribution calibrated to a 5% probability of drop-out within 12 months. The observed drop-out proportions in the summary can be lower because progression or the analysis cutoff can end observation before a simulated drop-out occurs.
The resulting estimated probability of rejecting at least one hypothesis is 8.2%. Individual rejection probabilities provide more information about the population in which benefit is demonstrated:
| Tested population | Rejection probability |
|---|---|
| S | 0.066 |
| F | 0.037 |
The result arrays order the tested populations as S and F. With the default successCriterion = "all", the fixed-design summary’s “Success per stage” is the probability of rejecting both hypotheses, estimated here at 2.1%. Trials that reject both contribute to each row of the table and count once in “Reject at least one.”
The 100-event target provides only about 31 events on average for the test in S, even though S accounts for 40% of the eligible population. Its lower baseline hazard and the delayed treatment benefit reduce its share of events. In addition, progression events during the first six months of a patient’s follow-up occur before the treatment effect begins. These features help explain the low probability of detecting the delayed benefit with this event budget.
The estimated expected sample size of randomized patients is 387.6, and the expected study duration is 19.6 months. Recruitment can stop when the event-driven trial finishes, so 400 is a cap, not a requirement that every trial recruits exactly 400 patients. Conversely, follow-up can extend beyond the 20-month recruitment window if needed to observe the event target.
We can double check whether the event target was achieved in all the simulations:
Indeed, this is the case here. We would also receive a warning message if the event target was not achieved in any of the simulations.
We retain the same control distributions and subgroup prevalences as above, but now investigate three different treatment-effect scenarios:
| Situation | Treatment HR in S |
Treatment HR in R |
|---|---|---|
broadBenefit |
0.65 throughout | 0.65 throughout |
delayedS |
1 for six months, then 0.50 | 1 throughout |
globalNull |
1 throughout | 1 throughout |
The first situation favours investigating benefit in the full population, because both S and R experience a relevant (and actually the same) treatment effect. In the second, only S benefits, and its benefit is delayed. In the null situation, neither population has a treatment benefit. The fixed event budget will be assessed under all three situations.
hazardRatioSituations <- list(
broadBenefit = rbind(
S = c(0.65, 0.65),
R = c(0.65, 0.65)
),
delayedS = rbind(
S = c(1, 0.50),
R = c(1, 1)
),
globalNull = rbind(
S = c(1, 1),
R = c(1, 1)
)
)
piecewiseSituations <- getPiecewiseSurvivalTimeEnrichment(
piecewiseSurvivalTime = intervalStarts,
lambdaControls = lambdaControls,
hazardRatio = hazardRatioSituations
)
piecewiseSituationsPiecewise exponential enrichment survival time
Control hazards
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.0277 | 0.0385 |
| >=6 | 0.0277 | 0.0385 |
Details
User defined parameters
Control hazards
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.0277 | 0.0385 |
| >=6 | 0.0277 | 0.0385 |
Hazard ratios - broadBenefit
| Interval | S | R |
|---|---|---|
| 0 - <6 | 0.650 | 0.650 |
| >=6 | 0.650 | 0.650 |
Hazard ratios - delayedS
| Interval | S | R |
|---|---|---|
| 0 - <6 | 1.000 | 1.000 |
| >=6 | 0.500 | 1.000 |
Hazard ratios - globalNull
| Interval | S | R |
|---|---|---|
| 0 - <6 | 1.000 | 1.000 |
| >=6 | 1.000 | 1.000 |
Generated parameters
One matrix, a named list of matrices, or a three-dimensional array can be supplied in the hazardRatio argument of getPiecewiseSurvivalTimeEnrichment. The array dimensions are disjoint subgroup x interval x situation. It is also possible to transform a named list of matrices into an array using getPiecewiseHazardRatioArray:
[1] 2 2 3
[1] "broadBenefit" "delayedS" "globalNull"
The same formats are supported for treatment medians. Dividing each subgroup’s control medians by its HRs produces an equivalent median-based specification:
medianTreatmentSituations <- lapply(hazardRatioSituations, function(ratios) {
return(medianControls / ratios)
})
piecewiseSituationMedians <- getPiecewiseSurvivalTimeEnrichment(
piecewiseSurvivalTime = intervalStarts,
medianControls = medianControls,
medianTreatments = medianTreatmentSituations
)
all.equal(
as.data.frame(piecewiseSituations),
as.data.frame(piecewiseSituationMedians),
tolerance = 1e-12
)[1] TRUE
Within one specification, the subgroup control information (hazards or medians) is shared across situations. Separate simulation calls are needed when changing that matrix, the prevalences, or the recruitment assumptions.
We use a two-stage inverse-normal combination design, with no early efficacy rejection and an interim futility boundary of zero:
We compare typeOfSelection = "all" with "best". If the trial continues, "all" retains both tested populations, S and F. Since F includes R, recruitment can still include both disjoint subgroups. For "best", we use effectMeasure = "testStatistic" and select the population with the most favourable observed standardized log-rank statistic. This choice takes into account both the estimated benefit and the available information (in contrast to selecting based solely on the estimated benefit via the observed hazard ratio).
There is no event-number reassessment, so we keep the cumulative event budgets fixed at 50 and 100 (we discuss the details below). Let’s do it:
simulationArguments <- list(
design = designTwoStage,
effectList = list(
subGroups = subGroups,
prevalences = prevalences,
piecewiseSurvivalTime = piecewiseSituations
),
simulationType = "patientWise",
directionUpper = FALSE,
intersectionTest = "SpiessensDebois",
stratifiedAnalysis = TRUE,
effectMeasure = "testStatistic",
plannedEvents = c(50, 100),
allocationRatioPlanned = 1,
accrualTime = c(0, 20),
accrualIntensity = 20,
accrualIntensityType = "absolute",
maxNumberOfSubjects = 400,
dropoutRate1 = 0.05,
dropoutRate2 = 0.05,
dropoutTime = 12,
kappa = 1,
maxNumberOfIterations = maxNumberOfIterations,
maxNumberOfRawDatasetsPerStage = 1,
seed = 1234
)
# Run first with `typeOfSelection = "all"`:
simulationAll <- do.call(
getSimulationEnrichmentSurvival,
c(simulationArguments, list(typeOfSelection = "all"))
)
# Now run with `typeOfSelection = "best"`:
simulationBest <- do.call(
getSimulationEnrichmentSurvival,
c(simulationArguments, list(typeOfSelection = "best"))
)If only S is selected, subsequent recruitment is restricted to S, and only its data contribute to subsequent selected-population analyses. If F is selected, both S and R remain eligible. Earlier observations are handled by the combination testing procedure.
plannedEvents = c(50, 100) requests 50 events up to interim and 50 additional events for the next stage. After selection, the additional events are counted in the selected disjoint subgroups.
For example, if 15 of the first 50 events occurred in S and only S is retained, the next analysis requires cumulative 15 + 50 = 65 events in S, and not 100 events in S. Events already observed in R remain part of the budget spent at the first analysis; they are not replaced by extra S events. Events occurring after selection in excluded R patients do not contribute to the next selected-population target.
If F remains selected, all 50 first-stage events belong to the retained population, so the final target is 100 events in F. When both S and F are tested, an S event is also an F event; it is not counted twice in the overall event budget.
The comparison table shows the probability of rejecting at least one hypothesis, its Monte Carlo standard error, the expected number of randomized patients, and the expected study duration. Under globalNull, rejection of at least one hypothesis estimates the family-wise Type I error probability:
situationNames <- dimnames(piecewiseSituations$hazardRatio)$situation
summarizeSimulation <- function(result, strategy) {
probability <- result$rejectAtLeastOne
data.frame(
Strategy = strategy,
Situation = situationNames,
RejectionProbability = probability,
MonteCarloSE = sqrt(probability * (1 - probability) / maxNumberOfIterations),
ExpectedPatients = result$expectedNumberOfSubjects,
ExpectedDuration = result$studyDuration
)
}
comparison <- rbind(
summarizeSimulation(simulationAll, "Both populations"),
summarizeSimulation(simulationBest, "Best population")
)
knitr::kable(comparison, digits = c(0, 0, 3, 4, 1, 1),
col.names = c("Strategy", "Situation", "Reject at least one",
"Monte Carlo SE", "Expected patients", "Expected duration (months)")
)| Strategy | Situation | Reject at least one | Monte Carlo SE | Expected patients | Expected duration (months) |
|---|---|---|---|---|---|
| Both populations | broadBenefit | 0.470 | 0.0071 | 388.7 | 20.5 |
| Both populations | delayedS | 0.076 | 0.0038 | 337.6 | 17.0 |
| Both populations | globalNull | 0.021 | 0.0020 | 321.7 | 16.2 |
| Best population | broadBenefit | 0.517 | 0.0071 | 389.2 | 22.2 |
| Best population | delayedS | 0.125 | 0.0047 | 341.3 | 19.4 |
| Best population | globalNull | 0.021 | 0.0020 | 326.4 | 17.5 |
The population-specific rejection probabilities are also important. With no early efficacy rejection, all rejections in this two-stage example occur at stage 2:
summarizePopulationPower <- function(result, strategy) {
data.frame(
Strategy = strategy,
Situation = situationNames,
RejectS = result$rejectedPopulationsPerStage[2, , 1],
RejectF = result$rejectedPopulationsPerStage[2, , 2]
)
}
populationPower <- rbind(
summarizePopulationPower(simulationAll, "Both populations"),
summarizePopulationPower(simulationBest, "Best population")
)
knitr::kable(populationPower, digits = c(0, 0, 3, 3),
col.names = c("Strategy", "Situation", "Reject S", "Reject F")
)| Strategy | Situation | Reject S | Reject F |
|---|---|---|---|
| Both populations | broadBenefit | 0.215 | 0.450 |
| Both populations | delayedS | 0.062 | 0.040 |
| Both populations | globalNull | 0.012 | 0.013 |
| Best population | broadBenefit | 0.111 | 0.406 |
| Best population | delayedS | 0.101 | 0.024 |
| Best population | globalNull | 0.010 | 0.010 |
Under delayedS, selecting one population raises estimated power for S from 6.2% to 10.1%, while reducing it for F from 4% to 2.4%. Under broadBenefit, selecting one population also raises the chance of any rejection, even though both individual rejection probabilities fall. With both populations retained, a single trial can reject both hypotheses. With one selected population and no early efficacy rejection, the two outcomes are mutually exclusive. If the intended efficacy claim is for the full population, the F column is the relevant comparison.
The best-population strategy extends the mean trial duration by 2.4 months under delayedS, with little change in the expected number randomized. When only S continues, the next 50 events must come from that subgroup, which can lengthen follow-up. The estimated probabilities of any rejection with the best-population strategy are 51.7% under broad benefit and 12.5% under delayed benefit, both well below conventional planning targets of 80% or 90%.
The null estimate needs to be interpreted with its simulation precision. An exact binomial confidence interval is:
[1] 0.01684473 0.02492854
attr(,"conf.level")
[1] 0.95
This interval describes Monte Carlo uncertainty for the best-population strategy under the specified global null. Note that family-wise error control which is guaranteed here by the adaptive design theory also protects the overall type I error under configurations in which only some of the tested hypotheses are true.

The plot identifies named situations. This avoids ambiguity because delayedS and globalNull both start with HR 1 in both disjoint subgroups, although their later distributions differ.
The selection probabilities below are unconditional probabilities of continuing with the specified tested population. With "best", only one population is retained, so the probabilities for S and F sum to the continuation probability rather than to one.
selectionTable <- data.frame(
Situation = situationNames,
SSelected = simulationBest$selectedPopulations[2, , 1],
FSelected = simulationBest$selectedPopulations[2, , 2],
ReachesStage2 = simulationBest$iterations[2, ] / maxNumberOfIterations,
MeanInterimTime = simulationBest$analysisTime[1, ]
)
knitr::kable(selectionTable, digits = c(0, 3, 3, 3, 1),
col.names = c("Situation", "S selected", "F selected",
"Reaches stage 2", "Mean interim time (months)")
)| Situation | S selected | F selected | Reaches stage 2 | Mean interim time (months) |
|---|---|---|---|---|
| broadBenefit | 0.218 | 0.695 | 0.912 | 14.4 |
| delayedS | 0.336 | 0.252 | 0.588 | 13.2 |
| globalNull | 0.256 | 0.242 | 0.498 | 13.1 |
Under delayedS, 57% of trials that continue select S. Across all simulated trials, 34% select S and 41% stop at interim. The unconditional probability is the relevant starting point for estimating how often the trial will switch to subgroup-only recruitment.
Compare interim timing with the end of the planned recruitment window at month 20. The mean alone does not give the probability that an individual trial makes its selection before recruitment ends. Nevertheless, selection can affect the remaining recruitment only when it occurs before those patients have entered the trial.
An operational assumption deserves particular attention: the simulation keeps the specified calendar recruitment schedule after enrichment. The eligibility mix changes, but recruitment does not automatically slow down because only S remains eligible. Maintaining 20 randomized patients per month in a subgroup with 40% screening prevalence could require screening approximately \(20/0.40 = 50\) patients per month, before allowing for other screening failures. This screening burden is not the randomized-patient count reported by the simulation.
If the same screening capacity would instead reduce the inclusion rate after restriction to S, the operating characteristics need to be investigated under an appropriate recruitment model. The example does not represent that slowdown merely by entering the baseline prevalence.
The following checks identify event-target failures for each stage and situation. These must be considered when interpreting power or duration under patient limits and drop-out:
We retain at most one raw dataset per situation and stopping stage for diagnostics. These retained datasets are therefore not the complete Monte Carlo sample used to estimate rejection probabilities.
scenario iterationNumber subGroup treatmentGroup survivalTime
1 1 1 R 1 60.320614
2 1 1 S 2 11.308181
3 1 1 S 1 148.181538
4 1 1 S 2 25.946043
5 1 1 S 1 7.445882
6 1 1 S 2 54.358335
timeUnderObservation
1 14.278789
2 11.308181
3 14.178789
4 14.128789
5 7.445882
6 14.028789
subGroup is S or R; treatmentGroup is 1 for treatment and 2 for control. A patient in S is also part of the full population F, but there is no additional set of F patients in the raw data. The scenario values follow the order broadBenefit, delayedS, globalNull. Use this identifier rather than trying to identify situations from their initial HRs.
A generated survivalTime may exceed timeUnderObservation. It is a latent event time and must not be treated as an observed progression time when the observation was censored.
Enrichment planning involves two related choices: which patients remain eligible and which population hypotheses the trial aims to demonstrate.
It is a good idea to assess the proposed event budget and selection rule across plausible subgroup prognoses and treatment effects. We can check the power in each tested population, the chance of reaching the event targets, and whether interim selection occurs early enough to change recruitment. We should also vary biomarker prevalence, recruitment feasibility after enrichment, and the futility rule. When delayed benefit is plausible, we should vary the timing of benefit as well.
For a final planning assessment, we should use more simulation iterations and report the associated Monte Carlo uncertainty.
For all simulation arguments and supported survival inputs, see ?getSimulationEnrichmentSurvival and ?getPiecewiseSurvivalTimeEnrichment. Related examples cover enrichment designs for testing rates (i.e. binary enrichment trials) and survival simulation more generally.