Skip to content

Commit

Permalink
Update test based on glmmTMB fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 1, 2024
1 parent 868144c commit 363d102
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ Config/Needs/website:
r-lib/pkgdown,
easystats/easystatstemplate
Config/rcmdcheck/ignore-inconsequential-notes: true
Remotes: glmmTMB/glmmTMB/glmmTMB#1102
17 changes: 8 additions & 9 deletions tests/testthat/test-r2.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ withr::with_environment(
out2 <- r2(m2)
expect_equal(out[[1]], out2[[1]], tolerance = 1e-3, ignore_attr = TRUE)
# zero-inflated --------------------------------------------------------------
skip_if_not(packageVersion("glmmTMB") > "1.1.10")
skip_if_not_installed("pscl")
data(bioChemists, package = "pscl")
m <- glmmTMB::glmmTMB(
Expand All @@ -88,16 +89,14 @@ withr::with_environment(
data = bioChemists
)
out <- r2(m)
expect_equal(out[[1]], 0.14943, tolerance = 1e-3, ignore_attr = TRUE)
## FIXME: since glmmTMB 1.1.10(?) Pearson residuals differ and results
## are no longer identical, see https://github.com/glmmTMB/glmmTMB/issues/1101
expect_equal(out[[1]], 0.1797549, tolerance = 1e-3, ignore_attr = TRUE)
# validate against pscl::zeroinfl
# m2 <- pscl::zeroinfl(
# art ~ fem + mar + kid5 + ment | kid5 + phd,
# data = bioChemists
# )
# out2 <- r2(m2)
# expect_equal(out[[1]], out2[[1]], tolerance = 1e-3, ignore_attr = TRUE)
m2 <- pscl::zeroinfl(
art ~ fem + mar + kid5 + ment | kid5 + phd,
data = bioChemists
)
out2 <- r2(m2)
expect_equal(out[[1]], out2[[1]], tolerance = 1e-3, ignore_attr = TRUE)
# Gamma --------------------------------------------------------------
clotting <<- data.frame(
u = c(5, 10, 15, 20, 30, 40, 60, 80, 100),
Expand Down

0 comments on commit 363d102

Please sign in to comment.