Skip to content

Post-hoc analysis for the effect of a lower-order interaction

1 message · Lenth, Russell V

#
Please refer to the package's vignette on interactions:
    https://cran.r-project.org/web/packages/emmeans/vignettes/interactions.html

The simple way is to use the 'interaction' argument in 'contrast()' to generate interaction contrasts. For example:

    > library(emmens)

    > noise.lm <- lm(noise/10 ~ size * type * side, data = auto.noise)
    > EMM <- emmeans(noise.lm, ~ size*side*type)

    > contrast(EMM, interaction = "pairwise")
     size_pairwise side_pairwise type_pairwise estimate    SE df t.ratio p.value
     S - M         L - R         Std - Octel       0.50 0.624 24   0.802  0.4305
     S - L         L - R         Std - Octel       2.67 0.624 24   4.276  0.0003
     M - L         L - R         Std - Octel       2.17 0.624 24   3.474  0.0020

It is possible to do this manually by using 'contrast()' (or 'pairs()' method for pairwise comparisons) to create contrasts for one factor, calling 'contrast()' on the result to obtain contrasts of contrasts, etc. Here is the same example (with a multiplicity adjustment added) done manually:
type.diff   size.diff side.diff estimate    SE df t.ratio p.value
 Std - Octel S - M     L - R         0.50 0.624 24   0.802  0.8153
 Std - Octel S - L     L - R         2.67 0.624 24   4.276  0.0008
 Std - Octel M - L     L - R         2.17 0.624 24   3.474  0.0059

P value adjustment: sidak method for 3 tests

Russ Lenth