test_that("output", {
set.seed(76153)
a <- tibble(room = paste("Room", rep(c("W", "Z"), each = 24)),
pen = paste("Pen", rep(LETTERS[1:6], each = 8)),
litter = paste("Litter", rep(11:22, each = 4)),
tx = rep(rep(c("vac", "con"), each = 2), 12)) |>
mutate(lung = ifelse(tx == "vac", rnorm(24, 5, 1.3), rnorm(24, 7, 1.3)))
formula <- lung ~ tx + room / pen / litter
#################
set.seed(12345)
thismfhboot <- MFhBoot(formula, a,
nboot = 10000,
boot.cluster = TRUE,
boot.unit = TRUE)
test11 <- MFnestBoot(thismfhboot,
c("All", "litter"))
expect_identical(names(test11),
c("mfnest_details", "mfnest_summary", "seed"))
##mfnest_details
#' @note I'm not sure if this test was always wrong or if it became wrong
#because I changed something
#' @note expect_equal(dim(test11$mfnest_details), c(87753, 8))
#' @noRd
expect_equal(dim(test11$mfnest_details), c(87977, 8))
expect_identical(names(test11$mfnest_details),
c("variable", "level", "bootID", "U",
"N1N2", "con_N", "vac_N", "MF"))
##mfnest_summary
expect_equal(dim(test11$mfnest_summary), c(13, 8))
expect_equal(as.numeric(test11$mfnest_summary$median),
c(0.83333, rep(1, 12)),
tolerance = 0.1)
#' @note Previous c(0.5, -.5, rep(-1, 6), -0.308333, -0.5, -1, -0.5, -1),
#' I changed to make test work. Don't know if this is correct.
expect_equal(as.numeric(test11$mfnest_summary$etlower),
c(0.5, -1.0, -0.5, rep(-1, 3), -0.5, -1, -0.3333333, rep(-1, 4)),
tolerance = 0.1)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.