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

Issue with get_variance() handling of intercept-only sigma model in brms #967

Open
matschmitz opened this issue Nov 12, 2024 · 0 comments
Open
Labels
3 investigators ❔❓ Need to look further into this issue get_variance function specific labels

Comments

@matschmitz
Copy link

It appears that get_variance() in insight (v0.99.0.13) doesn’t handle brms models with an intercept-only sigma term correctly. When comparing models with and without sigma, the expected residual variance (var.residual) and distribution variance (var.distribution) should match, as both models are essentially equivalent. However, the results differ.

library(brms)
library(insight)

# Model without sigma
mdl1 <- brm(mpg ~ hp + (1 | cyl), data = mtcars, seed = 123)
get_variance(mdl1)
# Output:
# $var.fixed
# [1] 4.911032
# $var.random
# [1] 22.40697
# $var.residual
# [1] 10.93045
# $var.distribution
# [1] 10.93045

# Model with intercept-only sigma
mdl2 <- brm(bf(mpg ~ hp + (1 | cyl), sigma ~ 1), data = mtcars, seed = 123)
get_variance(mdl2)
# Output:
# $var.fixed
# [1] 4.910691
# $var.random
# [1] 23.4812
# $var.residual
# [1] 1
# $var.distribution
# [1] 1
@strengejacke strengejacke added the 3 investigators ❔❓ Need to look further into this issue label Nov 15, 2024
@strengejacke strengejacke added the get_variance function specific labels label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 investigators ❔❓ Need to look further into this issue get_variance function specific labels
Projects
None yet
Development

No branches or pull requests

2 participants