I am using lmer in R to check the effect of treatment and a group on some result (y). In my data (dat), there are 3 categorical variables and a continuous response variable: 1 id 1 treatment variable with 3 categories: ctrl, treat1, treat2 1 group variable with categories a, b, c And a continuous variable y.
I fit a lmer model:
library(lmer) library(emmeans)
Mod=lmer(y ~ Treatment*group +(1 | id), data=dat).
At first, i want to compare the change from control for the treat1, and treat2. (treat1 vs ctrl, treat2 vs ctrl). I know how to do this using trt.vs.ctrl contrasts in the emmeans package.
emmeans(Mod, trt.vs.ctrl~treat, data=dat)
At second, for each treatment (treat1 and treat2) i want to compare the change from control between the groups a and b, b and c, a and c.
For this latter, i want to set the contrasts in R with the emmeans package but don't know how to do it.
I would be grateful to anyone who will help me to find a way to solve this question. Thanks you in advance