Mathematical Notation for Mixed effect Model with stratified Intercept and Random Slope in brms

The big question here is why are you building the formula and which level of detail do you need?

You can usually check what exactly brms does for your by inspecting the result of make_stancode - there tends to be a bit of juggling with arrays representing the random effects which is hard to read, but taking time to understand it is IMHO useful for using brms safely.

Definitely also check out Understanding the Mathematical Model where a similar problem is discussed.

The Rethinking book has IMHO nice format for writing those equations, the slides at GitHub - rmcelreath/statrethinking_winter2019: Statistical Rethinking course at MPI-EVA from Dec 2018 through Feb 2019 are free and the lectures on GLMs and Multilevel models IMHO contain good examples of legible and clear formula.4

Feel free to ask for additional clarification if those resources don’t help you/still leave you confused :-)

Best of luck writing!

1 Like