For a model estimated in glmmTMB with a zero-truncated negative binomial distribution, I am trying the following to probe an interaction:

  • emmeans() to estimate marginal means
  • pairs(emmeans()) to estimate pairwise comparisons
  • ggeffect() to prepare the marginal means for plotting

It looks like the marginal means are different across the emmeans and ggeffects package due to different default weights. In emmeans(), weights = "equal" is the default, whereas I need to specify weights = "proportional" in emmeans() to have the results match ggeffect().

The pairwise comparisons for the "equal" and "proportional" marginal means yield different results. The estimates are similar, but the SEs and resulting p values are different. How should one determine which weighting to use if the original design is unbalanced?


1 Answer 1


It depends on a lot of things. But let's start with...

  • How many factors are there?
  • Are interactions included in the model?
  • If not, should interactions be included? E.g., have you even tried it, and looked at whether any of them are significant.
  • Have you looked at residual plots?

If interactions are playing a role here, it is quite possible that you shouldn't even be considering marginal means -- in which case the question of weights becomes moot.

Once you have a defensible model, the next step is to plot the predictions, e.g., using emmip().

Sometimes questions like those above seem annoying. But often, I see people racing for the finish line when they haven't even tied their shoes yet.

  • $\begingroup$ Thanks for your response. Yes, there are interactions in the model and we have plotted the predictions. I am probing an interaction between 2 binary variables following this example: stats.idre.ucla.edu/r/seminars/interactions-r/#s5a. It is from creating a publication-ready plot with ggeffects that I have noticed discrepancies between predicted values between packages, and am trying to determine how to resolve the discrepancies. When I specify weights = "proportional" in emmeans, the predicted values match across packages, but this changes the significance of the simple effects. $\endgroup$
    – user306245
    Dec 23, 2020 at 16:27
  • $\begingroup$ I think the choice of weights is related to the sampling model. If you have experimental data, then equal weights are probably preferred. If these are observational data, and you want to estimate what is true marginally, then one of the other weighting schemes may be preferable. But it depends on what factors truly are "nuisance" factors, etc. I'd be very cautious with this as I don't think it is straightforward or routine. You might also consider other models that exclude unneeded interactions. $\endgroup$
    – Russ Lenth
    Dec 24, 2020 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.