tests/testthat/test-independent-gs_b.R

test_that("gs_b() returns values as expected", {
  IF <- c(.6, .8, 1)
  par <- gsDesign::gsDesign(
    alpha = .02,
    k = length(IF),
    test.type = 1,
    sfu = gsDesign::sfLDOF,
    timing = IF
  )$upper$bound
  expect_equal(par, gs_b(par))

  par <- 1:10
  k <- 5
  expect_equal(par[5], gs_b(par, k = k))
})

test_that("gs_b() returns NA if the number of interim analysis is larger than the length of par", {
  IF <- c(.8, 1)
  par <- gsDesign::gsDesign(
    alpha = .025,
    k = length(IF),
    test.type = 1,
    sfu = gsDesign::sfLDOF,
    timing = IF
  )$upper$bound
  expect_true(is.na(gs_b(par, k = 3)))
})

Try the gsDesign2 package in your browser

Any scripts or data that you put into this service are public.

gsDesign2 documentation built on June 28, 2025, 1:09 a.m.