1

I have spent a lot of time on multiple posts and tutorials, but I still do not understand wich "rule" I have to apply to my current data, and why.

My experiment follows a within-subject design, as every subjects (n=17) performed a task in 2 conditions, accross 5 blocks of trials. VD is the mean RTs, fixed effects are condition and block, random effect is subject.

I would like to analyse the interaction between condition and block.

Using aov

I first aggregated my data:

ag<-aggregate(RT~condition+block+subject,data=d, FUN=mean)

But then I don't know if I have to include my within-subject factors into my Error term:

(1)aov<-aov(RT~ condition * block + Error(subject/(condition * block)), data=ag)  

OR

(2)aov<-aov(RT~ condition * block + Error(subject), data=ag)      

I have seen on several posts that the within factors have to be included in the error term, as in (1), but I do not understand how the dfs are calculated.

Using lmer

Additionally, I would like to attempt using lmer instead of aov.

I suspect that the equivalent of (2) would be:

lmer(RT ~ 1+(1|sujet)+condition*block, ag) 

But if it is the (1) which is the correct one, I can not figure out how does it would have to be specified using lmer.

Mikel Urkia
  • 2,087
  • 1
  • 23
  • 40
Raphaëlle
  • 11
  • 3
  • 1
    In the `aov` model, you don't need to include `subject` as a fixed effect. in the `lmer` model, you don't really need to specify the `1` in the fixed effect part. To do it in the `aov` way, you probably could do `(1 + condition*block|subject)` in the lmer model – Alex Mar 25 '15 at 19:49
  • Thank you a lot for your answer, actually adding "subject" as fixed effect or not give the result. But my main question was about the terms to put in the error statement : error(subject) or error(subject/condition*block) ? – Raphaëlle Mar 26 '15 at 09:58
  • 1
    `Error(subject/(condition*block))` if subjects are repeatedly measured across all conditions and all blocks – Alex Mar 26 '15 at 13:06
  • Thank you a lot, lmer model with (1 + condition*block|subject) and aov with Error(subject/(condition*block)) give me close results. As subjects are repeattedly measured across all conditions and blocks, I will use it this way. – Raphaëlle Mar 30 '15 at 08:11
  • if one is looking for explantions [here](https://stats.stackexchange.com/questions/60108/how-to-write-the-error-term-in-repeated-measures-anova-in-r-errorsubject-vs-e) and [here](https://stackoverflow.com/questions/37497948/aov-error-term-in-r-whats-the-difference-bw-errorid-and-errorid-timevar) and another example [here](https://stackoverflow.com/questions/12594796/aov-formula-error-term-contradictory-examples) – Simone May 01 '18 at 12:21

0 Answers0