-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for compare_parameters(effects = "random") (#338)
* Fix for compare_parameters(effects = "random") * fix * add test * lintr, fix test
- Loading branch information
1 parent
6782928
commit 7af4340
Showing
5 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
tests/testthat/_snaps/plot.compare_parameters/plot-compare-parameters-works.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
test_that("`plot()` for compare_parameters", { | ||
skip_if_not_installed("glmmTMB") | ||
skip_if_not_installed("lme4") | ||
skip_if_not_installed("parameters") | ||
gdat <- readRDS(system.file("vignette_data", "gophertortoise.rds", package = "glmmTMB")) | ||
form <- shells ~ prev + offset(log(Area)) + factor(year) + (1 | Site) | ||
gmod_glmer <- lme4::glmer(form, family = poisson, data = gdat) | ||
gprior <- data.frame( | ||
prior = "gamma(1e8, 2.5)", | ||
class = "theta", | ||
coef = "", | ||
stringsAsFactors = FALSE | ||
) | ||
gmod_glmmTMB <- glmmTMB::glmmTMB(form, family = poisson, priors = gprior, data = gdat) | ||
|
||
cp <- parameters::compare_parameters(gmod_glmer, gmod_glmmTMB, effects = "random") | ||
expect_warning(plot(cp), "No data left") | ||
|
||
skip_if_not_installed("vdiffr") | ||
vdiffr::expect_doppelganger( | ||
title = "plot.compare_parameters works", | ||
fig = plot(cp, show_intercept = TRUE) | ||
) | ||
}) |