I am trying to use R
to run Repeated-Measures ANOVA. Based on the data from:
https://www.youtube.com/watch?v=VPB3xrsFl4o&list=PL568547ACA9211CCA&index=75
The inputs in R
are:
anxiety = c(9,8,7,8,8,9,8,7,6,6,7,8,7,6,4,3,2,3,4,3,2)
time = c(rep("Before",7), rep("Week_1",7), rep("Week_2",7))
person = c(rep(c("Person_1","Person_2","Person_3","Person_4","Person_5","Person_6","Person_7"),3))
anxiety_data = data.frame(person, anxiety, time)
I think I should use aov()
function in this way:
Repeated_Measures_ANOVA = aov(anxiety ~ time + Error(person/time), data=anxiety_data)
Can I ask if the code is correct?
As the TukeyHSD()
function could not work
> TukeyHSD(Repeated_Measures_ANOVA, conf.level = 0.95)
Error in UseMethod("TukeyHSD") :
no applicable method for 'TukeyHSD' applied to an object of class "c('aovlist', 'listof')"
can I ask how to determine where the significant difference is if positive result is obtained?