I have the following loop which lets me do repeated measures ANOVA, to analyse if there is a significant difference between 1 mean rating (named Anger
here) against 8 other mean ratings (the 8 different emotions in the list) in a musical track.
As it is a repeated measures ANOVA, I am aware that a p-value
correction has to be made, hence I would like to do a Bonferroni
adjustment. However, I am not sure how to write it for this particular code and where it should be placed in the loop.
CODE:
trk <- fltr[fltr$Track == '001',]
lst <- c('Joy','Calm','Fear','Longing','Love','Power','Sad','Surprise')
for(k in 1:8){
trgt <- trk[trk$Emotion == 'Anger',]
other <- trk[trk$Emotion == lst[k],]
trgt <- rbind(trgt,other)
cat('Anger vs.', lst[k],'\n')
print(summary(aov(Rating ~ Emotion + Error(participant/Emotion),trgt)))
cat('\n')
}
Any help would be appreciated.
Thank you.