0
$\begingroup$

Somebody asked me about doing planned contrasts with repeated measures (within-subject design). I normally use contrasts with the lm function in R and have no experience with repeated measures.

So in my search to answer this question, I found the source below, which claims that you can do an lm model with repeated measures by simply adding an ID covariate which controls for the within-subject variance:

Testing Within-Subjects Contrasts (Repeated Measures) in R

Below I use ID as a blocking factor. This could seem nuts, but this approach “controls” for (i.e., partials out variance due to) subject ID. The polynomial contrast tests are equivalent to those you’d see from a special function or command for repeated measures ANOVA. I’ll demonstrate that later in this post [with afex::aov_car].

lm01 <- lm(score ~ linear + quadratic + cubic + id, data = lC11T5)

https://nmmichalak.github.io/nicholas_michalak/blog_entries/2018/nrg07/nrg07.html

I'm surprised because I thought for repeated measures people used linear mixed effects models through lme4::lmer() usually in this case. If it were that simple as adding id as a covariate, why does not everyone do this? Is this source wrong then? Why, or why not?

Is it safe then to compute planned contrasts with an lm model by controlling for id like that?

$\endgroup$

0

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.