tests/testthat/test-bs.R

test_that("Example 14.2", {
  bs.sample <- bs(ch14$example14.2, nsims.bs = 40, seed = 1)
  expect_equal(range(bs.sample$vector), c(0.805, 3.5))
  expect_equal(sd(bs.sample$vector), 0.46151393)
})

test_that("Example 14.5", {
  expect_equal(bs(ch14$example14.2, nsims.bs = 2000, CI.width = 0.95,
                  seed = 1)$CI, c(1.005, 2.74))
  expect_equal(bs(ch14$example14.2, nsims.bs = 2000, CI.width = 0.99,
                  seed = 1)$CI, c(0.69, 3.5))
  expect_equal(sd(bs(ch14$example14.2, nsims.bs = 2000, seed = 1)$vector),
               0.4144401)
})

Try the ANSM5 package in your browser

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

ANSM5 documentation built on Sept. 11, 2024, 6:45 p.m.