I am learning how to use Linear Mixed-Effects model instead of ANOVA. My data is investigating the effects of four different types of treatments on learning gain, which is measured at before and after the treatments. Some of the participants engaged in several types of treatments and took several types of measurements.
TYPE_OF_TREATMENT <- FACTOR(TYPE_OF_TREATMENT)
TEST_TIMING <- FACTOR(TEST_TIMING)
contrasts (TYPE_OF_TREATMENT) <- contr.sum(4)
contrasts (TEST_TIMING) <- contr.treatment(2, base = 1)
model <- lmer (learning_gain ~TYPE_OF_TREATMENT + TEST_TIMING +(1|participant)+(1|TEST_TIMING:participant)+(1|TYPE_OF_TREATMENT:participant))
require(multcomp)
summary(glht(res, linfct=mcp(TYPE_OF_TREATMENT="Tukey"), test = adjusted("holm")))
summary(glht(res, linfct=mcp(TEST_TIMING="Tukey"), test = adjusted("holm")))
My questions are:
Am I setting the contrasts appropriately? I have never cared about contrast when conducting ANOVA. What I would like to do is to compare differences of the learning gains among treatments (one by one; which should have been taken care of by glht() function.. hopefully). I am assuming, by using this sum contrast for treatment, I can get the estimated value for each treatment when doing
summary(model)
. And by using treatment contrast, I am seeing the comparison between post-test (as a factor) and pre-test (as intercept). The significance for each treatment means that the estimated value for each treatment is not 0 ... Am I understanding right?Is intercept in the results of
summary (model)
showing the estimated value for pre-test? Or does intercept include other values from TYPE_OF_TREATMENT as well?Sometimes, I can see lmer() function report the warning saying that
fixed-effect model matrix is rank deficient so dropping 28 columns / coefficients
This happens when I put interactions. Is this something I can ignore? Or, do I have to simplify the model until I eliminate this warning?
Thank you for your help!
glht
, though I am not sure about the effect of usingcontr.sum
andcontr.treatment
. My recommendation, tho, is to transition to usingemmeans
. I think it's a little easier to use, and can also handle contrasts on interactions. I wrote an answer with a simple example here: stats.stackexchange.com/questions/102857/post-hoc-after-glm . $\endgroup$