Skip to content

Commit

Permalink
tets, validate against mice
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 24, 2024
1 parent 0193c46 commit cffb3bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Suggests:
brglm2,
brms,
broom,
broom.mixed,
cAIC4,
car,
carData,
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-pool_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ test_that("pooled parameters, glmmTMB, components", {
test_that("pooled parameters, glmmTMB, zero-inflated", {
skip_if_not_installed("mice")
skip_if_not_installed("glmmTMB")
skip_if_not_installed("broom.mixed")
data(Salamanders, package = "glmmTMB")
set.seed(123)
Salamanders$cover[sample.int(nrow(Salamanders), 50)] <- NA
Expand Down Expand Up @@ -136,6 +137,17 @@ test_that("pooled parameters, glmmTMB, zero-inflated", {
tolerance = 1e-3
)

# validate against mice ---------------
m_mice <- suppressWarnings(with(data = impdat, exp = glmmTMB::glmmTMB(
count ~ mined + cover + (1 | site),
ziformula = ~mined,
family = poisson()
)))
mice_summ <- summary(mice::pool(m_mice, dfcom = Inf))
expect_equal(out$Coefficient, mice_summ$estimate, tolerance = 1e-3)
expect_equal(out$SE, mice_summ$std.error, tolerance = 1e-3)
expect_equal(out$p, mice_summ$p.value, tolerance = 1e-3)

out <- pool_parameters(models, component = "all", effects = "all")
expect_named(
out,
Expand Down

0 comments on commit cffb3bf

Please sign in to comment.