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.

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))
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:

  1. 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?

  2. 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?

  3. 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!

  • $\begingroup$ To address #3, yes, that sounds like a serious issue, and shouldn't be ignored. It probably has to do with the specification of you random interactions relative to the structure of the data and the number of observations. $\endgroup$ Dec 19, 2017 at 16:44
  • $\begingroup$ @SalMangiafico Thank you for your reply! I see. I have to admit that my data dose not have that many observations. That's a real bummer that I cannot see the interaction. $\endgroup$ Dec 19, 2017 at 16:52
  • 1
    $\begingroup$ I don't see anything wrong with how you are using glht, though I am not sure about the effect of using contr.sum and contr.treatment. My recommendation, tho, is to transition to using emmeans. 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$ Dec 19, 2017 at 16:52
  • $\begingroup$ I might try including the TYPE_OF_TREATMENT : TEST_TIMING interaction as a fixed effect and (1|Participant) as the only random effect. But I don't know what would be appropriate for your data or analysis. $\endgroup$ Dec 19, 2017 at 16:55
  • $\begingroup$ Thank you very much, @SalMangiafico! I have never heard emmeans before! I will try that now! And thank you for suggesting using ":". I will try that now too! $\endgroup$ Dec 19, 2017 at 17:01


Your Answer

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

Browse other questions tagged or ask your own question.