An Example to Illustrate Boundary Re-Calculations during the Trial with rpact

Planning
Survival
This document provides an example for updating the group sequential boundaries when using an \(alpha\)-spending function approach based on observed information rates in rpact. Since version 3.1 of rpact, an additional option in the getAnalysisResults() function provides an easy way to perform an analysis with critical values that are calculated subsequently during the stages of the trial.
Author
Published

February 16, 2024

Introduction

Group-sequential designs based on \(\alpha\)-spending functions protect the Type I error exactly even if the pre-planned interim schedule is not exactly adhered to. However, this requires re-calculation of the group sequential boundaries at each interim analysis based on actually observed information fractions. Unless deviations from the planned information fractions are substantial, the re-calculated boundaries are quite similar to the pre-planned boundaries and the re-calculation will affect the actual test decision only on rare occasions.

Importantly, it is not allowed that the timing of future interim analyses is “motivated” by results from earlier interim analyses as this could inflate the Type I error rate. Deviations from the planned information fractions should thus only occur due to operational reasons (as it is difficult to hit the exact number of events exactly in a real trial) or due to external evidence.

The general principles for these boundary re-calculation are as follows (see also, Wassmer & Brannath, 2016, p78f):

  • Updates at interim analyses prior to the final analysis:
    • Information fractions are updated according to the actually observed information fraction at the interim analysis relative to the planned maximum information.
    • The planned \(\alpha\)-spending function is then applied to these updated information fractions.
  • Updates at the final analysis in case the observed information at the final analysis is larger (“over-running”) or smaller (“under-running”) than the planned maximum information:
    • Information fractions are updated according to the actually observed information fraction at all interim analyses relative to the observed maximum information. \(\Rightarrow\) Information fraction at final analysis is re-set to 1 but information fractions for earlier interim analyses are also changed.
    • The originally planned \(\alpha\)-spending function cannot be applied to these updated information fractions because this would modify the critical boundaries of earlier interim analyses which is clearly not allowed. Instead, one uses the \(\alpha\) that has actually been spent at earlier interim analyses and spends all remaining \(\alpha\) at the final analysis.

This general principle be implemented via a user-defined \(\alpha\)-spending function and is illustrated for an example trial with a survival endpoint below. We provide two solutions to the problem: the first is a way how existing tools in rpact can directly be used to solve the problem, the second is an automatic recalculation of the boundaries using a new parameter set (maxInformation and informationEpsilon) which is available in the getAnalysisResults() function since rpact version 3.1. This solution is described in Section @ref(sec:automatic) at the end of this document.

First, load the rpact package

library(rpact)
packageVersion("rpact") # version should be version 3.1 or later
[1] '4.0.0'

Original trial design

The original trial design for this example is based on a standard O’Brien & Fleming type \(\alpha\)-spending function with planned efficacy interim analyses after 50% and 75% of information as specified below.

# Initial design
design <- getDesignGroupSequential(
    sided = 1, alpha = 0.025, beta = 0.2,
    informationRates = c(0.5, 0.75, 1), typeOfDesign = "asOF"
)

# Initial sample size calculation
sampleSizeResult <- getSampleSizeSurvival(
    design = design,
    lambda2 = log(2) / 60, hazardRatio = 0.75,
    dropoutRate1 = 0.025, dropoutRate2 = 0.025, dropoutTime = 12,
    accrualTime = 0, accrualIntensity = 30,
    maxNumberOfSubjects = 1000
)

# Summarize design
kable(summary(sampleSizeResult))
Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
1 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 500 500 1000 386.7994 1 33.33333 30 1 0 35.77325 0.025 0.025 12 0.1679704 0.5399906 39.08167 57.9635 69.10659 193.3997 385.7188 371.7163 318.3396 1000 0.6530755
2 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 500 500 1000 386.7994 1 33.33333 30 1 0 35.77325 0.025 0.025 12 0.3720202 0.5399906 52.71020 57.9635 69.10659 290.0995 385.7188 371.7163 318.3396 1000 0.7580507
3 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 500 500 1000 386.7994 1 33.33333 30 1 0 35.77325 0.025 0.025 12 0.2600094 0.5399906 69.10659 57.9635 69.10659 386.7994 385.7188 371.7163 318.3396 1000 0.8147969

Boundary and power update at the first interim analysis

Assume that the first interim was conducted after 205 rather than the planned 194 events.

The updated design is calculated as per the code below. Note that for the calculation of boundary values on the treatment effect scale, we use the function getPowerSurvival() with the updated design rather than the function getSampleSizeSurvival() as we are only updating the boundary, not the sample size or the maximum number of events.

# Update design using observed information fraction at first interim.
# Information fraction of later interim analyses is not changed.
designUpdate1 <- getDesignGroupSequential(
    sided = 1, alpha = 0.025, beta = 0.2,
    informationRates = c(205 / 387, 0.75, 1), typeOfDesign = "asOF"
)

# Recalculate the power to get boundary values on the effect scale
# (Use original maxNumberOfEvents and sample size)
powerUpdate1 <- getPowerSurvival(
    design = designUpdate1,
    lambda2 = log(2) / 60, hazardRatio = 0.75,
    dropoutRate1 = 0.025, dropoutRate2 = 0.025, dropoutTime = 12,
    accrualTime = 0, accrualIntensity = 30,
    maxNumberOfSubjects = 1000, maxNumberOfEvents = 387, directionUpper = FALSE
)

The updated information rates and corresponding boundaries as per the output above are summarized as follows:

Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
1 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 387 1 33.33333 30 1 0 35.81097 0.025 0.025 12 316.9625 0.8000659 0.2097158 0.5391135 40.60037 57.75244 69.1443 205.00 1000 0.6700080
2 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 387 1 33.33333 30 1 0 35.81097 0.025 0.025 12 316.9625 0.8000659 0.3293977 0.5391135 52.73331 57.75244 69.1443 290.25 1000 0.7575116
3 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 387 1 33.33333 30 1 0 35.81097 0.025 0.025 12 316.9625 0.8000659 0.2609524 0.5391135 69.14430 57.75244 69.1443 387.00 1000 0.8147891

Boundary and power update at the second interim analysis

Assume that the efficacy boundary was not crossed at the first interim analysis and the trial continued to the second interim analysis which was conducted after 285 rather than the planned 291 events. The updated design is calculated in the same way as for the first interim analysis as per the code below. The idea is to use the cumulative \(\alpha\) spent from the first stage and an updated cumulative \(\alpha\) that is spent for the second stage. For the second stage, this can be obtained with the original O’Brien & Fleming \(\alpha\)-spending function:

# Update design using observed information fraction at first and second interim.
designUpdate2 <- getDesignGroupSequential(
    sided = 1, alpha = 0.025, beta = 0.2,
    informationRates = c(205 / 387, 285 / 387, 1), typeOfDesign = "asOF"
)

# Recalculate power to get boundary values on effect scale
# (Use original maxNumberOfEvents and sample size)
powerUpdate2 <- getPowerSurvival(
    design = designUpdate2,
    lambda2 = log(2) / 60, hazardRatio = 0.75,
    dropoutRate1 = 0.025, dropoutRate2 = 0.025, dropoutTime = 12,
    accrualTime = 0, accrualIntensity = 30,
    maxNumberOfSubjects = 1000, maxNumberOfEvents = 387, directionUpper = FALSE
)
kable(summary(powerUpdate2))
Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
1 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 387 1 33.33333 30 1 0 35.81097 0.025 0.025 12 317.2007 0.8004461 0.2097158 0.519824 40.60037 57.82025 69.1443 205 1000 0.6700080
2 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 387 1 33.33333 30 1 0 35.81097 0.025 0.025 12 317.2007 0.8004461 0.3101082 0.519824 51.93116 57.82025 69.1443 285 1000 0.7531456
3 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 387 1 33.33333 30 1 0 35.81097 0.025 0.025 12 317.2007 0.8004461 0.2806220 0.519824 69.14430 57.82025 69.1443 387 1000 0.8150820

Boundary and power update at the final analysis

Assume that the efficacy boundary was also not crossed at the second interim analysis and the trial continued to the final analysis which was conducted after 393 rather than the planned 387 events. The updated design is calculated as per the code below. The idea here to use the cumulative \(\alpha\) spent from the first and the second stage stage and the final \(\alpha\) that is spent for the last stage. An updated correlation has to be used and the original O’Brien & Fleming \(\alpha\)-spending function cannot be used anymore. Instead, the \(\alpha\)-spending function needs to be user defined as follows:

# Update boundary with information fractions as per actually observed event numbers
# !! use user-defined alpha-spending and spend alpha according to actual alpha spent
#    according to the second interim analysis
designUpdate3 <- getDesignGroupSequential(
    sided = 1, alpha = 0.025, beta = 0.2,
    informationRates = c(205, 285, 393) / 393,
    typeOfDesign = "asUser",
    userAlphaSpending = designUpdate2$alphaSpent
)

# Recalculate power to get boundary values on effect scale
# (Use planned sample size and **observed** maxNumberOfEvents)
powerUpdate3 <- getPowerSurvival(
    design = designUpdate3,
    lambda2 = log(2) / 60, hazardRatio = 0.75,
    dropoutRate1 = 0.025, dropoutRate2 = 0.025, dropoutTime = 12,
    accrualTime = 0, accrualIntensity = 30,
    maxNumberOfSubjects = 1000, maxNumberOfEvents = 393, directionUpper = FALSE
)
kable(summary(powerUpdate3))
Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
1 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 393 1 33.33333 30 1 0 36.94689 0.025 0.025 12 320.0817 0.8059817 0.2097158 0.519824 40.60037 58.3657 70.28023 205 1000 0.6700080
2 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 393 1 33.33333 30 1 0 36.94689 0.025 0.025 12 320.0817 0.8059817 0.3101082 0.519824 51.93116 58.3657 70.28023 285 1000 0.7531456
3 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 393 1 33.33333 30 1 0 36.94689 0.025 0.025 12 320.0817 0.8059817 0.2861577 0.519824 70.28023 58.3657 70.28023 393 1000 0.8161525

Overview of all updates

For easier comparison, all discussed boundary updates and power calculations are summarized more conveniently below. Note that each update only affects boundaries for the current or later analyses, i.e., earlier boundaries are never retrospectively modified.

Original design

Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
1 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 500 500 1000 386.7994 1 33.33333 30 1 0 35.77325 0.025 0.025 12 0.1679704 0.5399906 39.08167 57.9635 69.10659 193.3997 385.7188 371.7163 318.3396 1000 0.6530755
2 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 500 500 1000 386.7994 1 33.33333 30 1 0 35.77325 0.025 0.025 12 0.3720202 0.5399906 52.71020 57.9635 69.10659 290.0995 385.7188 371.7163 318.3396 1000 0.7580507
3 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 500 500 1000 386.7994 1 33.33333 30 1 0 35.77325 0.025 0.025 12 0.2600094 0.5399906 69.10659 57.9635 69.10659 386.7994 385.7188 371.7163 318.3396 1000 0.8147969

Updated boundaries and power at the first, second, and final analysis

Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
1 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 393 1 33.33333 30 1 0 36.94689 0.025 0.025 12 320.0817 0.8059817 0.2097158 0.519824 40.60037 58.3657 70.28023 205 1000 0.6700080
2 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 393 1 33.33333 30 1 0 36.94689 0.025 0.025 12 320.0817 0.8059817 0.3101082 0.519824 51.93116 58.3657 70.28023 285 1000 0.7531456
3 0.75 1 Schoenfeld FALSE 80 60 0.0086643 0.0115525 1000 1000 393 1 33.33333 30 1 0 36.94689 0.025 0.025 12 320.0817 0.8059817 0.2861577 0.519824 70.28023 58.3657 70.28023 393 1000 0.8161525

Automatic boundary recalculation at analysis stage

We now show how a concrete data analysis with an \(\alpha\)-spending function design can be performed by specifying the parameter maxInformation in the getAnalysisResults() function. As above, we start with an initial design, which in this situation is arbitrary and can be considered as a dummy design. Note that neither the number of stages nor the information rates need to be fixed.

# Dummy design
dummy <- getDesignGroupSequential(sided = 1, alpha = 0.025, typeOfDesign = "asOF")

The survival design was planned with a maximum of 387 events, the first interim took place after the observation of 205 events, the second after 285 events. Specifying the parameter maxInformation makes it now extremly easy to perform the analysis for the first and the second stage. Assume that we have observed log-rank statistics 1.87 and 2.19 at the first and the second interim, respectively. This observation together with the event numbers is defined in the getDataset() function through

dataSurvival <- getDataset(
    cumulativeEvents = c(205, 285),
    cumulativeLogRanks = c(1.87, 2.19)
)

Note that it is important to define cumulativeEvents and cumulativeLogRanks because otherwise the stage wise events and logrank statistics should be entered (in the given case, these will be calculated).

We now can enter the planned maximum number of events in the getAnalysisResults() function as follows:

testResults <- getAnalysisResults(
    design = dummy,
    dataInput = dataSurvival,
    maxInformation = 387
)

This provides the summary:

Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA
387 TRUE TRUE continue 0.1926659 0.870008 1.938043 0.1158636
387 TRUE TRUE continue 0.3986944 0.976239 1.721069 0.0379734
387 TRUE TRUE NA NA NA NA NA

We see that the boundaries are correctly calculated according to the observed information rates. If there is overrunning, i.e., the final analysis was conducted after 393 rather than the planned 387 events, first define the observed dataset

dataSurvival <- getDataset(
    cumulativeEvents = c(205, 285, 393),
    cumulativeLogRanks = c(1.87, 2.19, 2.33)
)

and then use the getAnalysisResults() function as before:

testResults <- getAnalysisResults(
    design = dummy,
    dataInput = dataSurvival,
    maxInformation = 387
)

The messages describe the way of how the critical value for the last stage using the recalculated information rates (leaving the critical values for the first two stages unchanged) was calculated. This way was described in Section @ref(sec:update). The last warning indicates that for this case, since there is no “natural” family of decision boundaries, repeated p-values for the final stage of the trial are not calculated.

The summary shows that indeed the recalculated boundary for the last stage and the already used boundaries for the first two stages are used for decision making:

Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA
387 TRUE TRUE continue 0.1909837 0.870008 1.938043 0.1158636 NA NA NA NA
387 TRUE TRUE continue 0.3883192 0.976239 1.721069 0.0379734 NA NA NA NA
387 TRUE TRUE reject NA 1.032426 1.549946 NA 0.0147568 1.023289 1.533512 1.254979

We also can consider the case of underrunning which is the case if, for example, it was decided before conducting the analysis that, say, also if up to 3 less events than the considered maximum number will be observed, this should be considered as the final analysis (i.e., the final stage is reached if 384 or more events were observed). Inserting the parameter informationEpsilon in the getAnalysisResults() function can be used for this. There are two ways for defining this parameter. You can do it

  1. in an absolute sense: the parameter informationEpsilon specifies the number of events to be allowed to deviate from the maximum number of events. This is achieved by specifying a positive integer number for informationEpsilon.
  2. in a relative sense: if a number x < 1 for informationEpsilon is specified, the stage is considered as the final stage if x% of maxInformation is observed.

Both ways yield a correct calculation of the critical value to be used for the final stage. Suppose, for example, 385 events were observed and informationEpsilon was set equal to 3. Then, since 387 - 385 < 3, this is an underrunning case and the critical value at the final stage is provided in the summary:

dataSurvival <- getDataset(
    cumulativeEvents = c(205, 285, 385),
    cumulativeLogRanks = c(1.87, 2.19, 2.21)
)
testResults <- getAnalysisResults(
    design = dummy,
    dataInput = dataSurvival,
    maxInformation = 387,
    informationEpsilon = 3
)
Warning in is.na(parameterValues): is.na() auf Nicht-(Liste oder Vektor) des
Typs 'environment' angewendet
object NA NA NA NA NA NA NA NA NA NA NA NA
387 3 TRUE TRUE continue 0.1932416 0.870008 1.938043 0.1158636 NA NA NA NA
387 3 TRUE TRUE continue 0.4023160 0.976239 1.721069 0.0379734 NA NA NA NA
387 3 TRUE TRUE reject NA 1.020563 1.537524 NA 0.0175296 1.015702 1.523861 1.2456

We see that again the recalculated boundary for the last stage and the already used boundaries for the first two stages are used for decision making.

In summary, maxInformation in the getAnalysisResults() function can be used to perform an \(\alpha\)-spending function approach in practice. Also, if at the analysis stage overrunning or (pre-defined) underrunnig takes place the use of the parameters maxInformation and informationEpsilon in the function provides an easy was to perform a correct analysis with the specified design.


System: rpact 4.0.0, R version 4.3.3 (2024-02-29 ucrt), platform: x86_64-w64-mingw32

To cite R in publications use:

R Core Team (2024). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/. To cite package ‘rpact’ in publications use:

Wassmer G, Pahlke F (2024). rpact: Confirmatory Adaptive Clinical Trial Design and Analysis. R package version 4.0.0, https://www.rpact.com, https://github.com/rpact-com/rpact, https://rpact-com.github.io/rpact/, https://www.rpact.org.