gs_power_rd: Group sequential design power under risk difference

View source: R/gs_power_rd.R

gs_power_rdR Documentation

Group sequential design power under risk difference

Description

Group sequential design power under risk difference

Usage

gs_power_rd(
  p_c = tibble::tibble(Stratum = "All", Rate = 0.2),
  p_e = tibble::tibble(Stratum = "All", Rate = 0.15),
  N = tibble::tibble(Stratum = "All", N = c(40, 50, 60), Analysis = 1:3),
  rd0 = 0,
  ratio = 1,
  weight = c("un-stratified", "ss", "invar"),
  upper = gs_b,
  lower = gs_b,
  upar = list(par = gsDesign(k = length(N), test.type = 1, sfu = sfLDOF, sfupar =
    NULL)$upper$bound),
  lpar = list(par = c(qnorm(0.1), rep(-Inf, length(N) - 1))),
  info_scale = c(0, 1, 2),
  binding = FALSE,
  test_upper = TRUE,
  test_lower = TRUE,
  r = 18,
  tol = 1e-06
)

Arguments

p_c

rate at the control group

p_e

rate at the experimental group

N

sample size

rd0

treatment effect under super-superiority designs, the default is 0

ratio

experimental:control randomization ratio

weight

weigting method, either "un-stratified" or "ss" or "invar"

upper

function to compute upper bound

lower

function to compare lower bound

upar

parameter to pass to upper

lpar

parameter to pass to lower

info_scale

the information scale for calculation

binding

indicator of whether futility bound is binding; default of FALSE is recommended

test_upper

indicator of which analyses should include an upper (efficacy) bound; single value of TRUE (default) indicates all analyses; otherwise, a logical vector of the same length as info should indicate which analyses will have an efficacy bound

test_lower

indicator of which analyses should include a lower bound; single value of TRUE (default) indicates all analyses; single value FALSE indicated no lower bound; otherwise, a logical vector of the same length as info should indicate which analyses will have a lower bound

r

Integer, at least 2; default of 18 recommended by Jennison and Turnbull

tol

Tolerance parameter for boundary convergence (on Z-scale)

Value

a tibble with columns Analysis, Bound, Z, Probability, theta, Time, AHR, Events

Examples

# --------------------- #
#      example 1        #
# --------------------- #
library(gsDesign)

# un-stratified case with H0: rd0 = 0
gs_power_rd(
  p_c = tibble::tibble(Stratum = "All",
                       Rate = .2),
  p_e = tibble::tibble(Stratum = "All",
                       Rate = .15),
  N = tibble::tibble(Stratum = "All",
                     N = c(20, 40, 60),
                     Analysis = 1:3),
  rd0 = 0,
  ratio = 1,
  upper = gs_b,
  lower = gs_b,
  upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lpar = c(qnorm(.1), rep(-Inf, 2))
)

# --------------------- #
#      example 2        #
# --------------------- #
# un-stratified case with H0: rd0 != 0
gs_power_rd(
  p_c = tibble::tibble(Stratum = "All",
                       Rate = .2),
  p_e = tibble::tibble(Stratum = "All",
                       Rate = .15),
  N = tibble::tibble(Stratum = "All",
                     N = c(20, 40, 60),
                     Analysis = 1:3),
  rd0 = 0.005,
  ratio = 1,
  upper = gs_b,
  lower = gs_b,
  upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lpar = c(qnorm(.1), rep(-Inf, 2))
)

# use spending function
gs_power_rd(
  p_c = tibble::tibble(Stratum = "All",
                       Rate = .2),
  p_e = tibble::tibble(Stratum = "All",
                       Rate = .15),
  N = tibble::tibble(Stratum = "All",
                     N = c(20, 40, 60),
                     Analysis = 1:3),
  rd0 = 0.005,
  ratio = 1,
  upper = gs_spending_bound,
  lower = gs_b,
  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
  lpar = c(qnorm(.1), rep(-Inf, 2))
)

# --------------------- #
#      example 3        #
# --------------------- #
# stratified case under sample size weighting and H0: rd0 = 0
gs_power_rd(
  p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.15, .2, .25)),
  p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.1, .16, .19)),
  N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
                     Analysis = rep(1:3, 3),
                     N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
  rd0 = 0,
  ratio = 1,
  weight = "ss",
  upper = gs_b,
  lower = gs_b,
  upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lpar = c(qnorm(.1), rep(-Inf, 2)))

# --------------------- #
#      example 4        #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 = 0
gs_power_rd(
  p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.15, .2, .25)),
  p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.1, .16, .19)),
  N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
                     Analysis = rep(1:3, 3),
                     N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
  rd0 = 0,
  ratio = 1,
  weight = "invar",
  upper = gs_b,
  lower = gs_b,
  upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lpar = c(qnorm(.1), rep(-Inf, 2)))

# --------------------- #
#      example 5        #
# --------------------- #
# stratified case under sample size weighting and H0: rd0 != 0
gs_power_rd(
  p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.15, .2, .25)),
  p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.1, .16, .19)),
  N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
                     Analysis = rep(1:3, 3),
                     N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
  rd0 = 0.02,
  ratio = 1,
  weight = "ss",
  upper = gs_b,
  lower = gs_b,
  upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lpar = c(qnorm(.1), rep(-Inf, 2)))

# --------------------- #
#      example 6        #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 != 0
gs_power_rd(
  p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.15, .2, .25)),
  p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
                       Rate = c(.1, .16, .19)),
  N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
                     Analysis = rep(1:3, 3),
                     N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
  rd0 = 0.03,
  ratio = 1,
  weight = "invar",
  upper = gs_b,
  lower = gs_b,
  upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lpar = c(qnorm(.1), rep(-Inf, 2)))
  

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