0
$\begingroup$

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?

$\endgroup$
5
  • $\begingroup$ try reading ? contrast and vignette("contrasts", "emmeans") for starters. Note that in the method argument, you may specify a list of contrast coefficients. $\endgroup$
    – Russ Lenth
    Commented Oct 7, 2020 at 2:18
  • $\begingroup$ I recommend using a one-sided formula and calling contrast on the result. $\endgroup$
    – Russ Lenth
    Commented Oct 7, 2020 at 2:22
  • $\begingroup$ Thank you. I think I kind of got the solution. First I define the interested factors e.g. A=c(0,0,0,0,1,0) and B=c(0,1,0,0,0,0,0). Then I call contrast(emm1, method = list("A-B" = A - B)). This seemed to work $\endgroup$
    – efrem
    Commented Oct 8, 2020 at 15:47
  • 1
    $\begingroup$ I'd have thought that it should be A = c(1,0,0,0,0,0) but what you have is cirrect if A is the next-to-last level $\endgroup$
    – Russ Lenth
    Commented Oct 8, 2020 at 21:14
  • $\begingroup$ Yes, you are right, what I wrote does not match the data! Sorry about that $\endgroup$
    – efrem
    Commented Oct 9, 2020 at 17:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.