Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for compare_parameters(effects = "random") #338

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

strengejacke
Copy link
Member

library(glmmTMB)
library(lme4)
library(blme)
library(ggplot2); theme_set(theme_bw())
library(easystats)

gdat <- readRDS(system.file("vignette_data", "gophertortoise.rds", package = "glmmTMB"))
form <- shells~prev + offset(log(Area)) + factor(year) + (1 | Site)
gmod_glmer <- glmer(form, family = poisson, data = gdat)

gmod_bglmer <- bglmer(form, family=poisson, data=gdat)
## cov.prior = gamma(shape = 2.5, rate = 0, common.scale = TRUE, posterior.scale = "sd"))
gmod_glmmTMB <- glmmTMB(form, family = poisson, data = gdat) ## 1e-5
## bglmer default corresponds to gamma(Inf, 2.5)
gprior <- data.frame(prior = "gamma(1e8, 2.5)",
                     class = "theta",
                     coef = "")
gmod_glmmTMB_p <- update(gmod_glmmTMB, priors = gprior)
vc1 <- c(VarCorr(gmod_glmmTMB_p)$cond$Site)
vc2 <- c(VarCorr(gmod_bglmer)$Site)
all.equal(vc1, vc2, tolerance = 5e-4)

compare_parameters(
  gmod_glmer, gmod_glmmTMB, gmod_bglmer, gmod_glmmTMB_p,
  effects = "random"
) |> plot()

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 31.57895% with 13 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@6782928). Click here to learn what that means.

Files Patch % Lines
R/plot.compare_parameters.R 31.57% 13 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #338   +/-   ##
=======================================
  Coverage        ?   47.95%           
=======================================
  Files           ?       67           
  Lines           ?     5086           
  Branches        ?        0           
=======================================
  Hits            ?     2439           
  Misses          ?     2647           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@strengejacke strengejacke merged commit 7af4340 into main Apr 5, 2024
24 of 27 checks passed
@strengejacke strengejacke deleted the compare_parameters_random branch April 5, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant