# Non hierarchical deviation to a mean slope

• Operating System: Ubuntu 18.04.1
• brms Version: 2.5.0

Hello!

My aim is to fit a model within which I estimate a common slope for each group, and the deviation of each group to the common slope. However, I have only 4 groups, and I think it is counterproductive to use hierarchical prior on such a few groups (far longer estimations without real gain, imho). Could you enlight me about how to formulate this in brms?

\mu _i= \alpha + ...+ \beta_1x_i + \beta_{1g}x_i

I tried

y = intercepts + x + (x:groups)


But it produces a reference group, which I would prefer to avoid. Presenting a common slope and deviations would also be simpler than presenting the slopes of each groups separatly, to reveal common patterns.

Thank you!
Lucas

Go for y ~ groups*x but use sum-coding on group. See ?contr.sum.

The good old method :) I guess brms uses model.matrix internally to produce data!

Thank you Paul!

Yes, brms uses all the standard functions suchs as model.frame and model.matrix.