Calculating average marginal effects in models with random slopes

Thanks @paul.buerkner I appreciate your reply and glad to know that you would have used fitted() as well. Seems similar in spirit to elsewhere on these forms — eg Inferences marginal of random effects in multi-level models.

Since this approach is correct as far as I can tell for single level models and is ?maybe? okay with random effects, I’ve thrown together a rough draft package with functions to help implement it on here. It can be installed via:
devtools::install_github("JWiley/brmsmargins")
@rvlenth if you’d like to implement anything along these lines in emmeans I’d be happy to chat or please feel free to any of my code

1 Like