inst/tinytest/test-simon2stage.R

set.seed(123)
x <- list(design_nr=c(1:7),
          r1 = c(1, 2, 1, 1, 1, 1, 1),
          n1 = c(14, 15, 14, 12, 11, 11, 10),
          r2 = c(4, 4, 5, 5, 5, 5, 5),
          n2 = c(7, 7, 11, 14, 16, 17, 19),
          N = c(21, 22, 25, 26, 27, 28, 29),
          eff = c("5/21 (23.8%)", "5/22 (22.7%)", "6/25 (24%)", "6/26 (23.1%)", "6/27 (22.2%)", "6/28 (21.4%)", "6/29 (20.7%)"),
          "90%CI_low" = c(9.94, 9.78, 11.09, 10.83, 10.59, 10.26, 10.16),
          "90%CI_high" = c(38.71, 38.87, 38, 38.15, 38.71, 38.21, 40.07),
          EN.p0 = c(16.9075960163903, 16.2884274837447, 18.5690794543276, 16.773968474954, 15.8422899168, 16.1449330366, 15.0141203471),
          PET.p0 = c(0.58462914051567, 0.815938930893609, 0.58462914051567, 0.659002251789, 0.6973568802, 0.6973568802, 0.7360989291),
          MIN = c("Minimax", "", "", "", "", "", ""),
          OPT = c("", "", "", "", "", "", "Optimal"),
          ADMISS = c("", "Admissible", "", "", "", "", ""),
          alpha = c(0.0511412111636123, 0.0543042568921355, 0.0323533353291089, 0.0359671496394093, 0.0395005174857133, 0.0450489137027961, 0.0470863066438917),
          beta = c(0.203705615682959, 0.200846440508983, 0.202576987295816, 0.195219552505977, 0.193804599302928, 0.177745666977773, 0.194937086849675),
          p0 = c(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1),
          pa = c(0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3),
          alpha_param = c(0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05),
          beta_param = c(0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2))

expect_equivalent(
  current = as.list(simon2stage(p0=0.1,pa=0.3,alpha=0.05,beta=0.2,eps = 0.005,N_min=1,N_max=50)),
  target = x)
IDDI-BE/PhIIdesign documentation built on June 5, 2021, 2:03 p.m.