library(dplyr)
library(gsDesign2)
# Average hazard ratio
# \donttest{
x <- fixed_design_ahr(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12, hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36
)
x %>%
to_integer() %>%
summary()
# FH
x <- fixed_design_fh(
alpha = 0.025, power = 0.9,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
rho = 0.5, gamma = 0.5,
study_duration = 36, ratio = 1
)
x %>%
to_integer() %>%
summary()
# MB
x <- fixed_design_mb(
alpha = 0.025, power = 0.9,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12, hr = c(1, .6),
dropout_rate = .001
),
tau = Inf, w_max = 2,
study_duration = 36, ratio = 1
)
x %>%
to_integer() %>%
summary()
# }
# \donttest{
# Example 1: Information fraction based spending
gs_design_ahr(
analysis_time = c(18, 30),
upper = gs_spending_bound,
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL),
lower = gs_b,
lpar = c(-Inf, -Inf)
) %>%
to_integer() %>%
summary()
gs_design_wlr(
analysis_time = c(18, 30),
upper = gs_spending_bound,
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL),
lower = gs_b,
lpar = c(-Inf, -Inf)
) %>%
to_integer() %>%
summary()
gs_design_rd(
p_c = tibble::tibble(stratum = c("A", "B"), rate = c(.2, .3)),
p_e = tibble::tibble(stratum = c("A", "B"), rate = c(.15, .27)),
weight = "ss",
stratum_prev = tibble::tibble(stratum = c("A", "B"), prevalence = c(.4, .6)),
info_frac = c(0.7, 1),
upper = gs_spending_bound,
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL),
lower = gs_b,
lpar = c(-Inf, -Inf)
) %>%
to_integer() %>%
summary()
# Example 2: Calendar based spending
x <- gs_design_ahr(
upper = gs_spending_bound,
analysis_time = c(18, 30),
upar = list(
sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL,
timing = c(18, 30) / 30
),
lower = gs_b,
lpar = c(-Inf, -Inf)
) %>% to_integer()
# The IA nominal p-value is the same as the IA alpha spending
x$bound$`nominal p`[1]
gsDesign::sfLDOF(alpha = 0.025, t = 18 / 30)$spend
# }
Run the code above in your browser using DataLab