I have 3 IVs: Within --> Hand(left,right), Time(pre,post); Between --> Training (treatment, sham) and a continuous DV: RT.
I have run a linear mixed effect model to see if there are significant interactions using this line:
model1 = lmer(RT ~ Training*Time*Hand + (1|Sub), data = db)
Then I want to see the differences between some of the levels (i.e., treatment-before-left and treatment-after-left) and adjust the pvalues using the Holm method. However, I do not want to correct for "illogic" comparisons such as treatment-before-left vs sham-after-right.
The line I used was this:
emmeans(model1, list(pairwise ~ Hand * Time * Training), adjust="holm")
I thought of using adjust = "none"
and adjusting later for the planned comparisons but I don't know how to do that in R.
You didn't give a reproducible examples, but your strategy of computing unadjusted p-values, extracting a subset, and doing the Holm adjustment yourself sounds sensible — the two things you need to know are (1) how to extract the p-values from an emmeans
object (see below) and (2) how to compute adjusted p-values (answer: p.adjust(., "holm")
: this is a base-R function).
m1 <- lm(mpg ~ factor(carb), mtcars)
e1 <- emmeans(m1, list(pairwise ~ carb), adjust = "none")
pval1 <- as.data.frame(e1$pair)$p.value
e2 <- emmeans(m1, list(pairwise ~ carb), adjust = "holm")
pval2 <- as.data.frame(e2$pair)$p.value
all.equal(pval2, p.adjust(pval1, "holm")) ## TRUE