tests/testthat/test_bootstrapping.R

context("test bootstrap functions")
library(PVplr)

test_that("bootstrap_uncertainty correctly rejects bad '\by'\ values", {
  expect_that(mbm_bootstrap_uncertainty(test_df, mbm_variable_check(test_df),
                                   model = "xbx", by = "inappropriate value"), throws_error())
})
test_that("bootstrap_output correctly rejects bad '\by'\ values", {
  expect_that(mbm_bootstrap_output(test_df, mbm_variable_check(test_df),
                                   model = "xbx", by = "inappropriate value"), throws_error())
})
test_that("bootstrap_output_from_results correctly rejects bad '\by'\ values", {
  expect_that(mbm_bootstrap_output_from_results(mbm_xbx_model(test_df, mbm_variable_check(test_df)),
                                                mbm_variable_check(test_df),
                                   model = "xbx", by = "inappropriate value"), throws_error())
})

Try the PVplr package in your browser

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

PVplr documentation built on Feb. 16, 2023, 9:56 p.m.