library(tibble) library(dplyr) library(gt) #library(gsDesign2) devtools::load_all()
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:
gs_power_npe()
# 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()
# 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()
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()
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))
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()
gs_spending_bound()
TODO
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.