# Computation and interpretation of marginal effects in a GLMM

I am currently working on a GLMM model which uses a Poisson distribution and need to compute and interpret marginal effects from this model.

The model outcome consists of a count (COUNT) collected yearly for a number of different entities.

The model predictors are both dynamic and consist of YEAR and CONDITION, where CONDITION is a dynamic predictor which takes the values 0 or 1. (The CONDITION predictor can be 0 on all years, or perhaps 0 on some years and 1 on subsequent years.)

The GLMM model is fitted to the data using the GLMMadaptive package in R and has a syntax along these lines:

model <- mixed_model(
fixed = COUNT ~ YEAR * CONDITION,
random = ~ 1 + YEAR | ENTITY_ID,
data = DATA,
family = poisson())


The function marginal_coefs() applied to this model produces output similar to the one below:

              Estimate Std.Err z-value   p-value

(Intercept)          9.9867  3.0754  3.2473 0.0011652

YEAR                -1.0717  0.5093 -2.1040 0.0353749

CONDITION               1.2335  0.6905  1.7864 0.0740308

YEAR:CONDITION         -0.3668  0.1218 -3.0127 0.0025894


My first question is:

What is the scale used by marginal_coefs() for reporting marginal effects: log scale or natural scale of the COUNT response?

My second question is:

How should the marginal effect of CONDITION in the above output be interpreted (i.e., the one estimated as being equal to 1.2335)? Should it be interpreted on the average change (on what scale?) in the expected value of COUNT across all entities when YEAR = 0 (i.e., first year) associated with changing from CONDITION = 0 to CONDITION = 1 at those entities?

My third question is:

How should the marginal effect of YEAR in the above output be interpreted (i.e., the one estimated as being equal to -1.0717)? Should it be interpreted as the average change (on what scale?) in the expected value of COUNT associated with moving from one year to the next across all entities with CONDITION = 0?

My fourth question is:

How should the marginal interaction effect between YEAR and CONDITION be interpreted?

My fifth question is:

What if we wanted to report "simple" marginal effects for this model? Would that amount to reporting the marginal effect of YEAR when CONDITION = 0 separately from the marginal effect of YEAR when CONDITION = 1? Alternatively, would it entail reporting the marginal effect of CONDITION when YEAR = 0, the marginal effect of REGIME when YEAR = 1, etc. Not sure how people report marginal effects for dynamic predictors (one continuous, one binary) engaged in an interaction.

Thank you for any clues you can provide!

• Do you perhaps mean function marginal_coefs() from the GLMMadaptive package or is marginal_effects() a function from another package? Mar 14, 2019 at 20:25
• @DimitrisRizopoulos: Oops! Yes, I meant marginal_coefs() from GLMMadaptive - thanks for pointing that out. I now modified the post to include marginal_coefs() and clear up the confusion. I also added a couple more questions. Mar 14, 2019 at 21:02

The coefficients returned by function marginal_coefs() in GLMMadaptive are on the linear predictor scale, i.e., in the same scale as the coefficients you obtain directly from mixed_model() or glmer() of lme4.

The difference is in the interpretation of these coefficients. The coefficients that have the problematic interpretation are the ones directly returned from mixed_model() and glmer() because they have an interpretation conditional on the random effects. On the contrary, the coefficients you get from marginal_coefs() have the usual population interpretation you expect to get from a model.

In your example, lets take the coefficient for YEAR. From both glmer()/mixed_model() and from marginal_coefs() this coefficient denotes the difference in the log expected counts for a year increase for CONDITION set to the reference level. But the key difference is for which expected counts are we talking about. In particular,

• in glmer()/mixed_model() these are the expected counts conditional on the random effect, i.e., for a specific ENTITY_ID;
• in marginal_coefs() these are the expected counts across entities.

To give another example say that you have put sex into your model, with levels male and female. From glmer()/mixed_model() you would get the coefficient that would tell you what would be the difference in the log expected counts if a subject changed sex (i.e., conditional on the random effect; most often not what you want). Whereas from marginal_coefs() you would get the difference in the log expected counts between the group of males and the group of females (i.e., averaged over the subjects, what you typically want).

• Thank you for your superbly clear answer, Dimitris! One thing I am wondering is how marginal_coefs() would proceed if we were to control for a third (continuous) predictor in the model? Would it set the values of that predictor to a "typical" value or just average across all entities, regardless of what their value would be for this predictor? Mar 15, 2019 at 19:16
• What if we wanted to compute simple marginal effects to describe the marginal effect of YEAR separately for each CONDITION? When CONDITION = 0, the marginal simple effect of YEAR is -1.0717. When CONDITION = 1, the marginal simple effect of YEAR is -1.0717 + (-0.3668) = -1.4385. (Both of these are expressed on the log scale.) How can we compute the standard error for the latter effect? There doesn't seem to be any information in the output of marginal_coefs() on the covariance between the estimated effects of YEAR and YEAR:CONDITION. How would one go about getting that info? Mar 15, 2019 at 19:20
• If you do mcoefs <- marginal_coefs(<your_model>, std_errors = TRUE), then mcoefs\$var_betas gives you the covariances you are looking for. Mar 15, 2019 at 19:27
• Oh, perfect! The var_betas are exactly what I needed! Thank you, Dimitris! Mar 15, 2019 at 20:40