# Setting S = 50 and nsim = 50 for speed
# In practice you would want a much larger sample and more simulations
# One-sample case
set.seed(123)
cal_tbl1 <- calibrate_thresholds(
p_null = 0.1,
p_alt = 0.4,
n = seq(5, 15, 5),
N = 15,
pp_threshold = c(0.85, 0.9),
ppp_threshold = c(0.1, 0.2),
S = 10,
nsim = 10
)
optimize_design(cal_tbl1)
# Two-sample case
set.seed(456)
cal_tbl2 <- calibrate_thresholds(
p_null = c(0.1, 0.1),
p_alt = c(0.1, 0.5),
n = cbind(seq(5, 15, 5), seq(5, 15, 5)),
N = c(15, 15),
pp_threshold = c(0.8, 0.85),
ppp_threshold = c(0.2, 0.3),
delta = 0,
S = 10,
nsim = 10
)
optimize_design(cal_tbl2)
Run the code above in your browser using DataLab