# AME (Average Marginal Effect) for lme4::glmer using margins::margins command

I am running a logistic mixed model regression using lme4::glmer Command.

I wanted to report AME (average marginal effect for my coefficients). I used the following command (lme4 package's manual says it works for glmer so why not use that?): margins::margins

I have seen threads of questions and answers with similar topics that suggest: ggeffects::ggpredict

My problem is that ggpredict does not provide AMEs. It just gives me predictions for 50 levels of my independent variable.

Which one should I use and why? lme4 package's manual says it workd for glmer so why not use that? Why do people use and suggest ggeffects instead?

• Define your AME in terms of distribution parameters ore function of distribution parameters, then it is not hard to get the estimate of AME given you can get the estimate of parameters through logistic regression. – user158565 Jul 19 at 2:48

You can also obtain coefficients from a generalized linear mixed model that have the desired marginal interpretation. These coefficients are provided by function marginal_coefs() of the GLMMadaptive package. For an example, check here.

• it is not working: Error in UseMethod("marginal_coefs") : no applicable method for 'marginal_coefs' applied to an object of class "c('glmerMod', 'merMod')  – UseR2001 Jul 26 at 1:39
• You have to fit the model using the mixed_model() function of the GLMMadaptive package. – Dimitris Rizopoulos Jul 26 at 3:51