library(tibble)
library(dplyr)
library(gt)
#library(gsDesign2)
devtools::load_all()

Introduction of gs_power_npe()

gs_power_npe() derives group sequential bounds and boundary crossing probabilities for a design. It allows a non-constant treatment effect over time, but also can be applied for the usual homogeneous effect size designs. It requires + treatment effect (theta, theta1) + statistical information at each analysis (info, info0, info1) + a method of deriving bounds, such as fixed bounds or spending (upper, upar, lower, lpar).

The routine enables two things not available in the gsDesign package:

  1. non-constant effect,
  2. more flexibility in boundary selection.

Usage of gs_power_npe()

Example 1: Fixed bound {.tabset}

no futility bound

# Same fixed efficacy bounds,  (i.e., non-binding bound), null hypothesis
gs_power_npe(
  theta = rep(0, 3),
  info = (1:3) * 40,
  upar = gsDesign::gsDesign(k = 3,sfu = gsDesign::sfLDOF)$upper$bound,
  lpar = rep(-Inf, 3)) %>%
  filter(Bound == "Upper") %>% gt()

with futility bound

# Fixed bound
gs_power_npe(
  theta = c(.1, .2, .3),
  info = (1:3) * 40,
  upper = gs_b,
  upar = gsDesign::gsDesign(k = 3,sfu = gsDesign::sfLDOF)$upper$bound,
  lower = gs_b,
  lpar = c(-1, 0, 0)) %>% gt()

futility only at analysis 1

gs_power_npe(
  theta = c(.1, .2, .3),
  info = (1:3) * 40,
  upper = gs_b,
  upar = c(Inf, 3, 2),
  lower = gs_b,
  lpar = c(qnorm(.1), -Inf, -Inf)) %>% gt()

Example 2: spending bounds {.tabset}

lower spending based on non-zero effect

gs_power_npe(
  theta = c(.1, .2, .3), # non-zero effect
  info = (1:3) * 40,
  upper = gs_spending_bound,
  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
  lower = gs_spending_bound,
  lpar = list(sf = gsDesign::sfHSD, total_spend = 0.1, param = -1, timing = NULL))

2-sided symmetric spend

x <- gs_power_npe(
  theta = rep(0, 3),
  info = (1:3) * 40,
  # typically, 2-sided bounds are binding
  binding = TRUE,
  upper = gs_spending_bound,
  # O'Brien-Fleming spending
  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
  lower = gs_spending_bound,
  lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL))

x %>% gt()
# Re-use these bounds under alternate hypothesis
# Always use binding = TRUE for power calculations
gs_power_npe(
  theta = c(.1, .2, .3),
  info = (1:3) * 40,
  binding = TRUE,
  upar = (x %>% filter(Bound == "Upper"))$Z,
  lpar = -(x %>% filter(Bound == "Upper"))$Z) %>% gt()

Inner Logic of gs_spending_bound()

TODO



keaven/gsDesign2 documentation built on Oct. 13, 2022, 8:42 p.m.