I notice that emmeans::emmeans() will only correct for multiple comparisons within groups and not between groups. This means that if you perform a series of contrasts that each involve a single comparison, but which is performed for multiple groups, there will be no p value or CI adjustment.
I assume the authors have valid reasoning for this. So my question is:
- Is a family of comparisons requiring p/CI adjustment only those performed within a group, or is a family of comparisons all comparisons regardless of group?
For a tangible example of this, consider the following data set:
dat =
tibble(
id = factor(
c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30)),
group = factor(
c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B",
"B", "B", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C",
"C", "C", "C", "C", "C", "C", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B",
"C", "C", "C", "C", "C", "C", "C", "C", "C", "C")),
time = factor(
c("t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1",
"t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1",
"t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t1", "t2",
"t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2",
"t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2",
"t2", "t2", "t2", "t2", "t2", "t2", "t2", "t2")),
dv = c(112.3351351, 106.2767115, 85.97498519, 94.56917246,
102.4029377, 96.90074365, 106.6283194, 105.0811233,
81.82880209, 99.18720794, 123.9631567, 103.8324887, 80.28047265,
76.7988305, 109.7733382, 102.7802469, 114.3847556, 105.1958354,
101.4281409, 94.03792896, 114.4768239, 118.2030177, 114.018257,
90.48844963, 122.9059885, 119.6559235, 109.6761788, 123.3134245,
115.1970167, 98.73363312, 115.9047459, 93.03497563, 89.89520236,
67.40679933, 96.61396618, 109.0766327, 56.42345318, 80.97383497,
81.54527339, 90.61442551, 85.96806927, 91.15030977, 77.01813237,
88.70078778, 83.11691388, 84.83115907, 81.90959002, 103.6980138,
71.96358206, 73.50106612, 121.4016791, 108.4115863, 109.3652816,
98.99960444, 110.8002013, 111.0578472, 111.709104, 107.0648845,
109.0496619, 104.9821074)
)
Subject the data to a mixed ANOVA via afex::aov_ez:
model =
dat %>%
afex::aov_ez(
id = "id",
dv = "dv",
data = .,
between = "group",
within = "time")
Now compute the $t1 - t2$ contrasts within each group:
emm_int %>%
contrast(., method = "pairwise", by = "group")
No p value adjustment is made for multiple comparisons within groups. Of course we can perform a multiple comparison adjustment if we wish (e.g., Holm) using:
emm_int %>%
contrast(., method = "pairwise", by = "group") %>%
rbind() %>%
summary(adjust = "holm")
emmeansmultiple comparison adjustment. If I consider all contrasts computed foremm_intas referring to a single hypothesis family I can change thebyvariable when summarizing. Thanks! – pomodoro Sep 07 '19 at 09:34byvariables used in the summary. So withby = NULL, it's all one big family and otherwise it is smaller families. Also look at the annotations below the results, e.g., "holm method for 3 tests." which I think makes it pretty clear the size of the family. If there is bo such annotation, there is no family adjustment either because no adjustment is used, or the family size is 1. – Russ Lenth Jun 19 '20 at 18:18by = NULLin the call foremm_int, we would have been asking for asking for all comparisons among the 3x2=6 factor combinations --- a family of 15 comparisons instead of the 3 we show. – Russ Lenth Jun 19 '20 at 18:26