Description
Aim
We believe that there is something odd in the calculation of Final CIs at the first stage of a group sequential
design in RPACT for non-inferiority designs. We believe that this potential bug is only present for noninferiority
designs and at the first stage.
Our reasoning is based on the following:
- The results we get (Median unbiased estimate, Final CIs (lower + upper)) from a minimal reproducible
example are different from what we would anticipate - If we pretend that the design is not sequential, we should get CIs identical to the first stage Final CIs
in a non-inferiority GSD context. But we do not. - We get something else than the RPACT results when we calculate the confidence intervals by hand.
- Your source-code seems to adjust for the non-inferiority margin at all other interim stages and at the
final analysis, but not the very first.
We wish with this document to illustrate the potential bug in RPACT for the first stage adjusted confidence
intervals and median unbiased estimate for a non-inferiority design.
Minimal reproducable example
library(rpact)
# our design
design <- getDesignGroupSequential(
sided = 1, alpha = 0.025, beta = 0.1,
informationRates = c(2/3, 1), typeOfDesign = "asOF"
)
# our fake data - create a scenario where we stop right at the boundary
fakeData2 <- getDataSet(
overallEvents = c(1067), # number of events corresponding to 2/3s
overallLogRanks = c(-1.713),
overallAllocationRatio = c(1)
)
adjust_noninferiority <- getAnalysisResults(design = design,
dataInput = fakeData2,
directionUpper = F,
thetaH0 = 1.05)
# We look at the final stage (first stage in this example) confidence intervals
adjust_noninferiority
Here we anticipated that the Final CIs upper boundary would be closer to 1.05 (thetaH0) and that the
Median unbiased estimate would be equal to the observed cumulative effect size.
To check that the CI is uncorrect we can use that the stage-wise confidence interval at the first stage should
be equal to the naively calculated confidence interval which we can get from the fixed design model.
Fixed design - no interim
If we assume that it was not a sequential design, we get the following confidence intervals:
# our design
design <- getDesignGroupSequential(
sided = 1, alpha = 0.025, beta = 0.1,
informationRates = c(1)
)
# creating data that stops right at the boundary
fakeData <- getDataSet(
overallEvents = c(1067),
overallLogRanks = c(-1.713),
overallAllocationRatio = c(1)
)
# get the naive and adjusted inference
adjust_noninferirority <- getAnalysisResults(design = design,
dataInput = fakeData,
directionUpper = F,
thetaH0 = 1.05)
adjust_noninferirority
Here the upper confidence interval crosses one and is different from the GSD final CI.
Calculating Final CIs (upper limit) by hand
We are going to find the value of μ = log(HR) for which the probability if 2.5% of being greater than
-1.713 (non-inf) or -2.5095 (superiority).
Starting with non-inf:
upper_ci_noninf <- function(x) pnorm(-1.713, mean = (log(x))*sqrt(1067)/2) - 0.025
uniroot(upper_ci_noninf, lower = 0.7, upper = 1.2)$root
We get an upper limit of 1.015 which is different than the RPACT result. But the same as the fixed design
CI.
Comparing non-inferiority to superiority
If the trial was a superiority trial instead, we could re-use the non-inferiority group sequential design but
without specifying the thetaH0 argument. Here we observe that if we reject the null hypothesis at the first
stage, we get identical Final CIs and Median unbiased estimate as in the non-inferiority analysis. However,
all other measures of inference are different in this scenario:
# superiority fake data - creating data that stops right at the boundary
fakeData <- getDataSet(
overallEvents = c(1067),
overallLogRanks = c(-2.5095),
overallAllocationRatio = c(1)
)
# get the naive and adjusted inference
adjust_superiority <- getAnalysisResults(design = design,
dataInput = fakeData,
directionUpper = F)
adjust_superiority
Notice to do the analysis on the non-inferiority scale we needed to change the log-rank test to equal the
non-inferiority log-rank. Using the formula from Chen and Chen (Chen YH, Chen C. Testing superiority
at interim analyses in a non-inferiority trial. Stat Med. 2012 Jul 10;31(15):1531-42. doi: 10.1002/sim.5312.
Epub 2012 Mar 22. PMID: 22438208.)
We believe that the bug in RPACT is due to a missing adjustment of non-inferiority in the final CIs at the
first stage. Furthermore, we beleive that the non-inferiority analysis’ median unbiased estimate and final
CIs are incorrectly the same three measures of inference but based on a superiority trial.
This ends the arguments for the potential bug.