What is the difference between marginal effects and effect modification in brms?


I would appreciate if anyone could help me understand the difference between marginal effects and effect modification in brms's marginal_effects.brmsfit and in emmeans estimation based on a brms model.

The marginal effects are defined as “instantaneous rates of change: for a dichotomous explanatory variable, a marginal effect shows how predicted probabilities change when the variable changes from 0 to 1” here are elsewhere.

On the other hand, effect modification here and elsewhere is defined as “when the magnitude of the effect of the primary exposure on an outcome (i.e., the association) differs depending on the level of a third variable”.

Furthermore, the brms documentation says “Since we condition on rather than actually marginalizing variables, the name marginal_effects is possibly not ideally chosen in retrospect.”

And the documentation of emmeans states that " … EMMs are based on a model . Neither of these plots is an interaction plot of the data ; they are interaction plots of model predictions; and since both models do not include an interaction, no interaction at all is evident in the plots."

I fail to see where the overlap between these two measures ends. Specifically, what is the difference between marginal effects without interaction and marginal effects with interaction in brms in terms of their meaning?


First of all, I wouldn’t try to take the name “marginal_effects” in brms literally for the reason you already cited from the documentation.

brms:::marginal_effects() will give you the predicted means of the response conditional on all other predictors (whose values you can specify via the conditions argument). There is not much more happening there.


Hi @paul.buerkner. Your answer is very helpful.

Just one more question:

That means that there is no interaction being assumed when we do this:

me <- marginal_effects(fit, "log_Base4_c:Trt")

after the model below:

fit <- brm(count ~ log_Age_c + log_Base4_c +Trt + (1 | patient), data = epilepsy, family = poisson())

Am I right?

Thanks in advance.




Thank you very much, @paul.buerkner.


If you could name the marginal effects plot again, what would you call it?


That is a good question. Any thoughts? Thanks for your interest in this topic.


conditional_effects but I can still rename it and deprecate marginal_effects, which I will probably do at some point.