This question already has an answer here:
- R's lmer cheat sheet 3 answers
I have a question concerning a mixed model ANOVA conducted using the lmer function of the lme4 package. Despite a lengthy research across tutorials and forum entries I do not have a clear response to how exactly my lmer formula should be written.
32 participants take place in the study, half of which constitute the test group, the other half the control group. Both groups do a pre and a posttest, and in both testing sessions they see 18 items of 3 conditions (= 54 items per testing session), and the stimuli of each condition are not repeated in the pre and the posttest.
My question is now if the following formula is correct/complete and if the fact that we deal here with repeated measures is automatically calculated: (dv: dependent variable)
fit1 <- lmer(dv ~ (condition * session * group) + (1|item_ID) + (1|subj_ID) + group, myData, REML=FALSE)
Or is one of the following more accurate:
fit2 <- lmer(dv ~ (condition * session * group) + (1|item_ID) + (1+session|subj_ID) + group, myData, REML=FALSE) fit3 <- lmer(dv ~ (condition * session * group) + (1|item_ID) + (1+session+condition|subj_ID) + group, myData, REML=FALSE)
I have also conducted the ANOVA comparing the three models (
anova(fit1,fit2,fit3)) but given that these three models are not equally complex this comparison is actually not valid, is this assumption right?
Moreover, I have included the
pbkrtest package to obtain degrees of freedom and p values; are the obtained dfs usable for reporting the inferential statistics or do I need to apply an additional transformation?