I have the following kind of experimental setup. There are two different tasks (say A and B) the participants are performing. Each task is performed thrice (three times) by each participant. There is one measurement per performed task. In summary, I have data such as

Task Subject Score
A    1       10
A    1       20
A    1       15
B    2       5
B    2       10
B    2       30
...  ...     ...

I am not entirely sure which test to use. Clearly, the observations within each task are correlated, since each participant does the same thing several times.

Based on searching the web, I think this should be analyzed using some kind of ANOVA. Which test is the correct one?


1 Answer 1


There might be a better way to analyse your data but I think a first approach to do it in R could be to add another column called Trial (3 levels).

Task Subject Trial Score
A    1       1     10
A    1       2     20
A    1       3     15
B    2       1     5
...  ...     ...   ...

Then using the lmer function from the lme4 package you could create a model using your trial as random term:

mod1 <- lmer(Score ~ Task * Subject + (1|Trial), data=your_data)

Then for the ANOVA, you could use the Anova function from the car package on your model:


Finally, you would have to check if your model meet the assumptions. I believe this should be an appropriate way to analyse your data.

  • $\begingroup$ I should add that since your explanatory variables are categories, yes you can most likely analyse your data with ANOVA. The idea behind adding the trial column and run a linear mixed-effects model is to deal with the fact that your participants performed each task 3 times. $\endgroup$ Jun 21, 2016 at 16:29
  • $\begingroup$ One more thing, you should probably define each of your response variable as categorical using something like this code your_data$Task<-as.factor(your_data$Task) $\endgroup$ Jun 21, 2016 at 17:12
  • $\begingroup$ Sorry, in the previous comment I meant "... each of your explanatory variable..." $\endgroup$ Jun 21, 2016 at 17:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.