brms with broom.mixed for models without group effects
corriebar opened this issue · 2 comments
Hey,
I've been trying to follow a blog post on using brooms with brms. After failing to make it work with just brooms and finding out it moved to broom.mixed, I now get the error that my model doesn't have any group effects.
Now, if I understand correctly, this package is supposed to be for mixed/hierarchical models. Is it still planned to be able to use broom with brms also for non-hierarchical models?
library(tidyverse)
library(brms)
library(broom.mixed)
set.seed(1)
n <- 50
mu_c <- 0
mu_t <- 0.5
d <-
tibble(group = rep(c("control", "treatment"), each = n)) %>%
mutate(treatment = ifelse(group == "control", 0, 1),
y = ifelse(group == "control",
rnorm(n, mean = mu_c, sd = 1),
rnorm(n, mean = mu_t, sd = 1)))
fit <-
brm(data = d,
family = gaussian,
y ~ 0 + Intercept + treatment,
prior = c(prior(normal(0, 2), class = b),
prior(student_t(3, 1, 1), class = sigma)),
seed = 1)
tidy(fit)
#> Error: The model does not contain group-level effects.
Created on 2020-08-27 by the reprex package (v0.3.0)
This seems to be a relatively minor tweak. I believe your example should work now if you reinstall (remotes::install_github("bbolker/broom.mixed")
) ... let me know?
It first showed the same error after reinstalling but worked after restarting the session.