nemesis
nemesis

Reputation: 11

Correct model in R using lmer

I have a question regarding the correct model setup in R using lmer.

This is a repeated measures experiment

Each subject (20 in total) completed 4 different task for each stimulation condition (anode, cathode, and sham). The dependent variable is reaction times (rt)

I used this model but I am not sure if its correct. I am more concerned if the random effects are correctly assigned

model<- lmer(rt ~ task * stimulation + (task * stimulation|subject), data=dat)

Any help will be appreciated.

Thank you

Upvotes: 1

Views: 190

Answers (2)

Robert Long
Robert Long

Reputation: 6812

I have to disagree with the other answer that quotes Barr et al (2013) to "keep it maximal". This has been proven to be bad advice on so many occasions that the authors of lme4 had introduce code to check for singular fit. Not only that but Doug Bates (primary author of lme4 and probably the worlds leading authority on mixed models) and colleagues wrote a paper in 2015 specifically adressing problems brought about by the wish to "keep it maximal" - Parsimonious Mixed Models.

Of course I am not saying that checking for singular fits is a bad thing - it's a great thing, so something good certainly came from it.

So in this case we have (task * stimulation|subject) where task has 4 levels and stimulation has 3 so we are asking the software to estimate 8 variance-covariance parameters with only 20 subjects. I am not saying that this is impossible, but it just seems bizarre to me for this to be the goal. The Bates et al (2015) paper goes into considerable detail about how to handle the resulting problems and I have answered some questions on CV about how to do so here and here

So in summary, the other answer isn't necessarily wrong, but it can lead to a lot of problems.

Upvotes: 2

arranjdavis
arranjdavis

Reputation: 735

That looks good to me. You currently have what is known as the 'maximal' random effects structure (i.e., there is a random effect for all estimated fixed effects). This is preferable according to:

Barr, D. J., Levy, R., Scheepers, C., & Tily, H. J. (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of Memory and Language, 68(3), 255-278.

Upvotes: 2

Related Questions