Skip to content

Commit 3707a89

Browse files
committed
add test
1 parent 044f494 commit 3707a89

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/testthat/test-glmmTMB.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,5 +766,21 @@ withr::with_options(
766766
expect_identical(nrow(out), 46L)
767767
expect_equal(out$Coefficient, unlist(glmmTMB::ranef(m)), ignore_attr = TRUE, tolerance = 1e-4)
768768
})
769+
770+
test_that("robust SE/VCOV", {
771+
skip_if_not_installed("sandwich")
772+
skip_if(packageVersion("insight") <= "1.4.0")
773+
774+
out1 <- standard_error(m1)
775+
out2 <- sqrt(diag(insight::get_varcov(m1, component = "all")))
776+
expect_equal(out1$SE, out2[1:6], ignore_attr = TRUE, tolerance = 1e-4)
777+
778+
out1 <- standard_error(m1, vcov = "HC0")
779+
out2 <- sqrt(diag(insight::get_varcov(m1, vcov = "HC0", component = "all")))
780+
expect_equal(out1$SE, out2[1:6], ignore_attr = TRUE, tolerance = 1e-4)
781+
782+
## FIXME: model_parameters() currently fails with robust SE for mixed models
783+
# out <- model_parameters(m1, vcov = "HC0")
784+
})
769785
}
770786
)

0 commit comments

Comments
 (0)