You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been messing with emmeans and ggeffects and wanted to clarify something that I didn't find discussed in a vignette.
In the ggeffects documentation, if you want to average over the random effect in a prediction (not predict at random effect=0), you set margin='empirical'. This gives slightly different predictions from emmeans, while also averaging over a non-focal, fixed-effect factor in both cases. This non-focal factor is not balanced in the data.
I understand that the approach described in ggeffects is preferable when the data aren't experimental, but I found I get mean predictions (though not CI's) that match emmeans when I set margin='marginalmeans'.
Is the reason for this because emmeans assumes a balanced reference grid while margin='empirical' accounts for the unbalanced nature of the real data? Does setting margin='marginalmeans' effectively "assume" a balanced data set for the non-focal, fixed effect?
Other questions:
What is the cause of the slightly different CI's? I'm bootstrapping my data so I really only need to extract the mean prediction, but I am curious if the difference in CI is something being handled behind the scenes differently that would be worth being aware of in future applications.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi folks,
I've been messing with emmeans and ggeffects and wanted to clarify something that I didn't find discussed in a vignette.
In the ggeffects documentation, if you want to average over the random effect in a prediction (not predict at random effect=0), you set margin='empirical'. This gives slightly different predictions from emmeans, while also averaging over a non-focal, fixed-effect factor in both cases. This non-focal factor is not balanced in the data.
I understand that the approach described in ggeffects is preferable when the data aren't experimental, but I found I get mean predictions (though not CI's) that match emmeans when I set margin='marginalmeans'.
Is the reason for this because emmeans assumes a balanced reference grid while margin='empirical' accounts for the unbalanced nature of the real data? Does setting margin='marginalmeans' effectively "assume" a balanced data set for the non-focal, fixed effect?
Other questions:
What is the cause of the slightly different CI's? I'm bootstrapping my data so I really only need to extract the mean prediction, but I am curious if the difference in CI is something being handled behind the scenes differently that would be worth being aware of in future applications.
Thanks for any comments you care to make
Beta Was this translation helpful? Give feedback.
All reactions