I created lmm
using lmer
.
I want then look at the contrast using emmeans
(just an overview below)
$contrasts
contrast estimate SE df lower.CL upper.CL t.ratio p.value
A - B 14.3927 1.40 102 9.91 18.87 10.310 <.0001
A - C -0.9537 1.45 154 -5.55 3.64 -0.659 0.5957
A - D 14.2376 1.45 154 9.64 18.84 9.845 <.0001
A - E 11.2341 1.51 155 6.42 16.05 7.420 <.0001
A - F 12.9106 1.60 154 7.84 17.98 8.089 <.0001
A - H 12.5250 1.45 154 7.93 17.12 8.661 <.0001
A - I 14.2004 1.45 154 9.60 18.80 9.819 <.0001
B - L -15.3463 1.45 154 -19.94 -10.75 -10.612 <.0001
B - J -0.1550 1.45 154 -4.75 4.44 -0.107 0.9487
B - K -3.1586 1.51 155 -7.97 1.65 -2.086 0.0832
However, I only want to look at specific contrasts for example A - B
and D - E
I know I can use the
emmeans(l_glm_l1_cage[[1]], pairwise ~ timegroups, adjust = "fdr", at=list(timegroups=c("A", "B", "D", "E")))
but this of course gives me the pairwise comparisons. Any suggestions?
? contrast
andvignette("contrasts", "emmeans")
for starters. Note that in themethod
argument, you may specify a list of contrast coefficients. $\endgroup$contrast
on the result. $\endgroup$A=c(0,0,0,0,1,0)
andB=c(0,1,0,0,0,0,0)
. Then I callcontrast(emm1, method = list("A-B" = A - B))
. This seemed to work $\endgroup$A = c(1,0,0,0,0,0)
but what you have is cirrect if A is the next-to-last level $\endgroup$