# Repeated Measures Anova - ezANOVA fails

New user of RStudio here, beginner at statistics, grateful for any hints : )

I have data from a psychology experiment in which there is a control and an experimental group. Both groups are tested on reaction times (RTs) for locating where a dot appears on a screen (left/right). Before the dot appears, the participants are presented with two images, one on the left and one on the right. The images can be happy, sad, or neutral. The measures are repeated at three different points in time (T0, T1 and T2) :

``````     Emotion    Location     Time Group    RT     Score.D
1     Sad       Incongruent   T0    XP     625   22.83693
2     Happy     Congruent     T1    CTRL   783   22.83693
3     Sad       Congruent     T2    XP     578   22.83693
4     Happy     Incongruent   T0    XP     780   22.83693
5     Sad       Incongruent   T2    CTRL   566   22.83693
6     Happy     Congruent     T1    XP     535   22.83693
``````

Here is a subset of my data that can be directly imported in R :

``````structure(list(Emotion = structure(c(2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Happy",
"Sad"), class = "factor"), Location = structure(c(2L, 2L, 2L,
2L, 2L, 2L), .Label = c("Congruent", "Incongruent"), class = "factor"),
Time = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("T0",
"T1", "T2"), class = "factor"), Group = structure(c(2L, 2L,
2L, 2L, 2L, 2L), .Label = c("CTRL", "XP"), class = "factor"),
RT = c(625L, 783L, 578L, 780L, 566L, 535L), Score.D = c(22.83693,
22.83693, 22.83693, 22.83693, 22.83693, 22.83693)), row.names = c(NA,
6L), class = "data.frame")
``````

My supervisor told me to conduct a repeated measures ANOVA with the treatment type (control/experimental) as between-group factor, the D score as an independent variable and the three points in time as the within-group variable.

I am confused as to how I should achieve this in RStudio. Here is my attempt :

``````Incong.Cong.XP.CTRL.T0T1T2.formatted\$Group <- factor(Incong.Cong.XP.CTRL.T0T1T2.formatted\$Group)
Incong.Cong.XP.CTRL.T0T1T2.formatted\$Time <- factor(Incong.Cong.XP.CTRL.T0T1T2.formatted\$Time)
Incong.Cong.XP.CTRL.T0T1T2.formatted\$Emotion <- factor(Incong.Cong.XP.CTRL.T0T1T2.formatted\$Emotion)
rANOVA.BA.ech1 <- with(data = Incong.Cong.XP.CTRL.T0T1T2.formatted, aov(Score.D ~ Time*Emotion + Error(Group/(Time*Emotion))))
summary(rANOVA.BA.ech1)
``````

This works, but I cannot compute Mauchly's sphericity test on this, which I would very much like to do.
The package `ez` allows for a rANOVA together with Mauchly's test. Here is the code I tried :
`ezANOVA(Incong.Cong.XP.CTRL.T0T1T2.formatted, dv = .(Score.D), wid = .(generated_uid), within = .(Time,Emotion), between = .(Group), type = 1)`

But I get this error message :
`One or more cells is missing data. Try using ezDesign() to check your data.`
Yet there are no NA cells in the data...

What's wrong here ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.