# Set up and analyse planned contrasts in lmer() from lme4

I would like to analyse planned contrasts in my lmer() model from the lme4package.

I have three factors: group (levels: trt, cntr), cond1(levels: a, b), cond2(levels: x, y).

dat

id   group    cond1  cond2   outcome
1     trt      a       x       ...
1     trt      a       y
1     trt      b       x
1     trt      b       y
1     trt      a       x       ...
1     trt      a       y
1     trt      b       x
1     trt      b       y
2     cntr     a       x
2     cntr     a       y
2     cntr     b       x
2     cntr     b       y
...


I set up my model:

model<- lmer(rt~ group+ cond1 + cond2+ group:cond1 + group:cond2 + cond1:cond2+ group:cond1:cond2 + (1|id) + (1|item), data= dat, REML = FALSE)


My hypotheses are (group: trt> cntr; cond1: a> b; cond2: x>y).

So based on this post: How to set custom contrasts with lmer in R

I set up linear contrasts like this:

gr <- paste0(dat$group, dat$cond1, dat\$cond2)
gr <- aggregate(model.matrix(model) ~ gr, FUN = mean)


which yields this output:

group

(Intercept) group1 cond11 cond21 group1:cond11 cond11:cond21 group1:cond21 group1:cond11:cond21
cntray    1     0     1          0           0                0      0                 0
cntrax    1     0     1          1           0                1      0                 0
cntrby    1     0     0          0           0                0      0                 0
cntrbx    1     0     0          1           0                0      0                 0
trtay     1     1     1          0           1                0      0                 0
trtcax    1     1     1          1           1                1      1                 1
trtby     1     1     0          0           0                0      0                 0
trtbsub   1     1     0          1           0                0      1                 0


My contrasts are not quite correct yet but I was wondering what to do next? How do I get SE, CIs etc for these comparisions? I know that I can use Tukeys test but I would like to do one sided comparisons.