Hi brms users, I’m hoping to get eyes on this pr Add fast sum-to-zero parameterizations for group effects by spinkney · Pull Request #1919 · paul-buerkner/brms · GitHub
Warnings, it is large and it is AI generated because I’m not familiar with the brms repo nor do I have the time to make this pr. Does that mean it sucks? I hope not. I gave it the math and my notes on the s2z parameterization for hierarchical models that is equivalent to the conventional Bayesian model for normal and student-t effects. This includes both independent and dependent cases of the varying/random effects. I also gave it my notes on centering/non-centering and data driven partial centering so users can specify.
What I need from folks to to test it out in two ways. The first is find the bugs or short-cuts chatgpt did. The second, and more interesting, is to run your hierarchical models and compare the fitting times and diagnostics to the conventional fit.
The syntax is
bf(y ~ x * z + (1 + x * z | gr(g, s2z = TRUE)))
# centered physical S2Z coordinates (default)
gr(g, s2z = TRUE)
# standardized/non-centered S2Z coordinates
gr(g, s2z = TRUE, center = FALSE)
# a fixed partial-centering fraction
gr(g, s2z = TRUE, center = 0.35)
# group- and coefficient-specific fractions derived from the fitted design
gr(g, s2z = TRUE, center = "auto")
If you wish to have varying standard deviations for the effects (possibly because of domain knowledge) this is supported through a scale = "varying" argument.
bf(y ~ x * z +
(1 + x * z | gr(g, s2z = TRUE, scale = "varying")))
prior(normal(0, 0.20), class = "sdlog", group = "g", coef = "x")



