Skip to contents
library(tibble)
library(dplyr)
#library(gsDesign2)
devtools::load_all()

Introduction of gs_spending_bound()

gs_spending_bound() can be used to derive spending boundary in group sequential design. It is usually used in the upper = ... and lower = ... arguments in + gs_power_npe() + gs_design_npe() + gs_power_ahr() + gs_design_ahr() + gs_power_wlr() + gs_design_wlr() + gs_power_combo() + gs_design_combo()

Usage of gs_spending_bound()

Example 1

info <- (1:3) * 10
IF <- info / max(info)
k <- length(IF)

# 1st analysis
a1 <- gs_spending_bound(k = 1, efficacy = FALSE, theta = 0,
                        par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = IF, param = NULL), 
                        hgm1 = NULL)

b1 <- gs_spending_bound(k = 1, efficacy = TRUE, theta = 0,
                        par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = IF, param = NULL), 
                        hgm1 = NULL)
cat("The (lower, upper) boundary at the 1st analysis is (", a1, ", ", b1, ").\n")
## The (lower, upper) boundary at the 1st analysis is ( -3.710303 ,  3.710303 ).
# 2st analysis
a2 <- gs_spending_bound(k = 2, efficacy = FALSE, theta = 0,
                        par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = IF, param = NULL), 
                        hgm1 = h1(r = 18, theta = 0,  I = info[1],  a = a1, b = b1))

b2 <- gs_spending_bound(k = 2, efficacy = TRUE, theta = 0,
                        par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = IF, param = NULL), 
                        hgm1 = h1(r = 18, theta = 0,  I = info[1],  a = a1, b = b1))
cat("The upper boundary at the 2nd analysis is (", a2, ", ", b2, ").\n")
## The upper boundary at the 2nd analysis is ( -2.511434 ,  2.511434 ).
# 3nd analysis
# a3 <- gs_spending_bound(k = 2, efficacy = FALSE, theta = 0,
#                         par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = IF, param = NULL), 
#                         hgm1 = hupdate(r = 18, theta = 0,  I = info[2],  a = a2, b = b2, 
#                                        thetam1 = 0,  Im1 = info[2],  
#                                        gm1 = h1(r = 18, theta = 1,  I = info[1],  a = a1, b = b1)))
# 
# b3 <- gs_spending_bound(k = 2, efficacy = TRUE, theta = 0,
#                         par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = IF, param = NULL), 
#                         hgm1 = hupdate(r = 18, theta = 0,  I = info[2],  a = a2, b = b2, 
#                                        thetam1 = 0,  Im1 = info[2],  
#                                        gm1 = h1(r = 18, theta = 0,  I = info[1],  a = a1, b = b1)))
# cat("The upper boundary at the 2nd analysis is (", a3, ", ", b3, ").\n")

Inner Logic of gs_spending_bound()

TODO