Contents
Why use emmeans in r?
The emmeans package enables users to easily obtain least-squares means for many linear, generalized linear, and mixed models as well as compute contrasts or linear functions of least-squares means, and comparisons of slopes.
What is Emmeans?
emmeans-package. Estimated marginal means (aka Least-squares means) Description. This package provides methods for obtaining estimated marginal means (EMMs, also known as least-squares means) for factor combinations in a variety of models.
What is an interaction contrast?
Definitions: According to Keppel, an interaction contrast is performed when we test for differences in some contrast. on factor A as a function of a contrast on factor B. Interaction contrasts have one degree of freedom.
What is an estimated marginal mean?
For a covariate, the estimated marginal mean is the mean of Y for each group of the IV at one specific value of the covariate. By default in most software, this one specific value is the mean of the covariate.
What do marginal means tell you?
What is a Marginal Mean? A marginal mean is (as the name suggests) a mean found in the margins (i.e. the edges) of a contingency table. In other words, it’s the average scores from a group or subgroup in an experiment.
How to test the interaction contrasts in emmeans?
Finally, emmeans provides a joint_tests () function that obtains and tests the interaction contrasts for all effects in the model and compiles them in one Type-III-ANOVA-like table: You may even add by variable (s) to obtain separate ANOVA tables for the remaining factors:
How to adjust the expression of multiple comparisons in emmeans?
In the contrast column in the contrasts section we can see the expression of the comparisons has changed from additive comparisons (via subtraction) shown above to multiplicative comparisons (via division). The adjust argument can be used to change the type of multiple comparisons adjustment.
Which is the best way to use emmeans?
I’ve put together some basic examples for using emmeans, meant to be a complement to the vignettes. Specifically this post will demonstrate a few of the built-in options for some standard post hoc comparisons; I will write a separate post about custom comparisons in emmeans.
When to use post hoc methods in emmeans?
Models in which predictors interact seem to create a lot of confusion concerning what kinds of post hoc methods should be used. It is hoped that this vignette will be helpful in shedding some light on how to use the emmeans package effectively in such situations.