Home > Software engineering >  R: I do not get P-Values for rmANOVA using aov()
R: I do not get P-Values for rmANOVA using aov()

Time:03-24

Hi I have tried to perform a two-way repeated measures analysis, but I cannot get the p-values with my R code. Do you have any ideas what is wrong?

My Data: PID12 = Participant Number, Mode12 = Independent Variable1; Type12 = Independent Variable 2; ER12 = Dependent Variable

I have tried to perform the analysis with this R code:

myData.mean <- aggregate(main$ER,
                         by = list(main$PID, main$Mode, main$Task),
                         FUN = "mean")
colnames(myData.mean) <- c("PID12","Mode12","Task12","ER12")
myData.mean <- myData.mean %>% arrange(PID12)

stress.aov <- with(myData.mean,
                   aov(ER12 ~ Mode12   Task12   
                         Error(PID12 / Mode12 * Task12)))
summary(stress.aov)

That is the output:

> summary(stress.aov)

Error: PID12
Df Sum Sq Mean Sq F value Pr(\>F)
Residuals  1 0.3868  0.3868

Error: Task12
Df Sum Sq Mean Sq
Task12  1  6.669   6.669

Error: PID12:Mode12
Df Sum Sq Mean Sq
Mode12  1  1.071   1.071

Error: PID12:Task12
Df Sum Sq Mean Sq
Mode12  1 0.3777  0.3777

Error: PID12:Mode12:Task12
Df Sum Sq Mean Sq F value Pr(\>F)
Residuals  1 0.3164  0.3164

Error: Within
Df Sum Sq Mean Sq F value Pr(\>F)
Mode12      1   0.57  0.5707   0.454  0.502
Residuals 153 192.39  1.2574

As you can see, I do not get any p-values. Do you have any ideas why this could be? Thank you in advance for your answers! Of course, I am happy to answer any questions regarding the problem.

CodePudding user response:

It is not clear to me why you aggregate your data into means before doing the ANOVA, as an ANOVA is done on the raw data. This may very well be the reason why you do not get any p-values (and your results are neither valid nor interpretable).

CodePudding user response:

The problem is that there is no p-value available in your case because your model is singular. If there would be a p-value available you could run the following code:

summary(stress.aov)[[1]][["Pr(>F)"]][1]

Output:

NULL
  • Related