Sample size for 2-arm 2-stage trial: R package Trialsize vs rpact vs gsDesign

33 Views Asked by At

Which sample size calculation is correct? Intended design:

  • Superiority two-arm trial between drug A (intervention) vs drug B (comparator),
  • outcome is binomial (response or no response to treatment),
  • randomised,
  • alpha 0.05,
  • beta 0.2
  • one-sided (superiority) testing
  • drug A (intervention) expected response 40%
  • drug B (comparator) expected response 15%
  • superiority margin 11% i.e H0: intervention response rate - comparator response rate = 0.11
  • allocation ratio 1
  • interim analysis once, at 30% information rate.
#install.packages("TrialSize")
library(TrialSize)

# p1: test
# p2: reference
# k: allocation ratio
# delta: expected difference in proportion
# margin: non-inferiority or superiority margin
# H0: delta =< margin, HA: delta > margin
# but this is a fixed design with no interim analysis
ss1 <- TwoSampleProportion.NIS(alpha = 0.05, beta = 0.2, p1 = 0.4, p2 = 0.15, k = 1, delta = 0.25, margin = 0.11)
paste("Total sample size: ", round(ss1))
ss1.10 <- ss1/0.9
paste("Total sample size including 10% dropout: ", round(ss1.10))

Yields sample size of 116

library(rpact)
# pi1 intervention treatment
# pi2 comparator treatment
## interim ana at 30% information rate
## superiority margin: H0: pi(1) - pi(2) = 0.11
design <- getDesignGroupSequential(typeOfDesign = "OF", informationRates = c(0.30, 1), alpha = 0.05, beta = 0.2, sided = 1, tolerance = 1e-08)
designPlan <- getSampleSizeRates(design, riskRatio = FALSE, 
                                 thetaH0 = 0.11, #superiority margin
  normalApproximation = TRUE, pi1 = 0.40, pi2 = 0.15, groups = 2, allocationRatioPlanned =
  1)
summary(designPlan)
d2 <- as.data.frame(designPlan)
ss2 <- d2[1,12]
paste("Total sample size: ", round(ss2))
ss2.10 <- ss2/0.9
paste("Total sample size including 10% dropout: ", round(ss2.10))

Yields sample size of 239

library(gsDesign)
# Design assumptions

# Control rate for endpoint (comparator drug)
p1 <- 0.15
# Experimental rate (intervention drug)
p2 <- 0.4
# Difference in rates under H0
delta0 <- -0.11
# 1-sided Type I error
alpha <- 0.05
# Type 2 error (1 - targeted power)
beta <- 0.2
# Randomization ratio
ratio <- 1

# Number of analyses
k <- 2
# See gsDesign() help for description of boundary types
test.type <- 1
# If test.type = 5 or 6, this sets maximum spending for futility
# under the null hypothesis. Otherwise, this is ignored.
astar <- 0
# Timing (information fraction) at interim analyses
timing <- c(0.3,1) ############# information rate
# Efficacy bound spending function
sfu <- sfLDOF
# Upper bound spending function parameters, if any
sfupar <- c(0)
# Lower bound spending function, if used (test.type > 2)
sfl <- sfLDOF
# Lower bound spending function parameters, if any
sflpar <- c(0)
# Difference in event rates under null hypothesis
delta0 <- -0.11
# Difference in event rates under alternate hypothesis (< delta)
delta1 <- -0.25

# Derive group sequential design
x <- gsDesign(
  k = k,
  test.type = test.type,
  alpha = alpha, # 1-sided Type I error
  beta = beta,   # Type II error (1 - Power)
  astar = astar,
  timing = timing,
  sfu = sfu,
  sfupar = sfupar,
  sfl = sfl,
  sflpar = sflpar,
  delta1 = delta1,
  delta0 = delta0,
  endpoint = "Binomial",
  n.fix = n # Fixed design sample size from nBinomial above
)

gsBoundSummary(
  x,
  deltaname = "risk difference",
  digits = 4,
  ddigits = 2,
  tdigits = 1
)

cat(summary(x))

Yields sample size of 77

0

There are 0 best solutions below