Closed TurnipWu closed 4 months ago
Yes, this is an important warning and many users will want something different than what is offered here.
Accounting for random effects while marginalizing is a difficult problem, and as far as I know, there is currently no software in R which can do that.
One alternative is to switch to a Bayesian approach using brms. You can compare the "Mixed effects" vignette to the "Bayes" vignettes on marginaleffects.com
Dear @vincentarelbundock, I am reaching out with a question regarding the use of the marginaleffects package for computing marginal effects in mixed-effects models. As I was calculating the marginal effects for a mixed-effects model, I encountered a Warning message when using the slopes function with the argument re.form = NULL. The warning indicates that marginaleffects only takes into account the uncertainty in fixed-effect parameters. This warning has left me slightly confused. From my understanding, when using the predict.merMod function in the lme4 package with re.form = NULL, the output includes all random effects. Therefore, it seems to me that the uncertainty in the random effects should also be considered. I would greatly appreciate it if you could clarify this matter for me. Your insights would be most helpful, and any assistance you can provide will be warmly welcomed. Thank you very much for your time and consideration.