When attempting to vary the shape parameter in multilevel models, I seem to be getting extreme Rhats and very low effective samples. This often then transpires in extreme predictions and ones that do not appear to relate well to the data on which they’re trained.
To try to diagnose the root of the problem, I’ve created simplified versions of my problem and still run in to the same issues. There could easily be something I’m doing wrong with the way I’m constructing the model.
Here is a reproducible example, which I’ve tried to make as simple as possible, and one where I wouldn’t expect convergence issues:
n <- 100 Group1 <- data.frame(Group = "Group1", y = round(rnbinom(n, size = 10, mu = 20))) Group2 <- data.frame(Group = "Group2", y = round(rnbinom(n, size = 1, mu = 15))) df <- rbind(Group1, Group2) df$x1 <- df$y + rnorm(n, 5, 3) mod <- brm(bf(y ~ x1 + (1|Group), shape ~ (1|Group)), family = negbinomial(), data = df)
summary(mod) then typically displays effective sample sizes of approximately 2 and Rhats > 1000, across all parameters.
If I do not let the shape parameter vary:
mod <- brm(y ~ x1 + (1|Group)) family = negbinomial(), data = df)
I do not get the same convergence problems.
What could I be doing wrong? I’ve tried referring to this vignette but without solving my problem.
- Operating System: Windows 10 Home
- brms Version: 2.2.0