# MANOVA with repeated measures in R

#### frodo.jedi

##### New Member
Hello,
I need an help in performing a MANOVA in R, but I encountered some
problems both in the design and in the synthax with R.

I conducted a listening experiment in which 16 participants had to rate the audio
stimuli along 5 scales representing an emotion (sad, tender, neutral, happy and aggressive).
Each audio stimulus was synthesized in order to represent a particular emotion.
Participants had to move 5 sliders each of which corresponded to one of the 5 emotions.
The sliders range was [0,10] but participants were only informed about the extremities of
the sliders (not at all - very much). There was not a force choice, therefore potentially each
audio stimulus could be rated with all the scales (e.g. sad = 0.1, tender = 2.5,
neutral = 2., happy = 8.3, aggressive = 1.7).
There were 40 stimuli, each stimulus was repeated twice, for a total of 80 trials.
I want to demonstrate that the created stimuli were actually correctly classified in the
corresponding emotion. For example I expect that happy sounds result in happy ratings
by participants and that these happy ratings are greater than the other 4 responses.

To analyze the data I want to use a MANOVA with repeated measures. For this purpose
I would like to use the audio stimulus as independent variable having 40 levels, while
the 5 responses as dependent variables. Since each individual has been measured twice,
I include a within-subjects factor for trial number.

However, with 40 levels I would have 39 degrees of freedom, that with only 16
participants is not appropriate. For this reason I have also grouped the audio stimuli
by their type. So my independent variable could be Trial_type, having 20 levels.
Unfortunately, reducing in this way is still too few for 16 participants.
Therefore my idea is to perform a MANOVA not on the whole table, but separately
for each subset defining an emotion. In this way I would have just 4 lvels.
My question is: is this a correct approach to analyze data?
Or it is better to use other strategies?

For example, looking at the following .csv table which can be downloaded here:

https://dl.dropbox.com/u/3288659/Results_data_listening_Test_Grouped.csv
I create the subset for emotion Sad, and then I try to perform the MANOVA with

repeated measures on it:

idata<-data.frame(scrd$Trial_number) aov.emotions<-anova(model.emotions,idata=idata, idesign=~ Trial_type, type="III") Unfortunately I get the following error which I am not able to solve: > aov.emotions<-anova(model.emotions,idata=idata, idesign=~Trial, type="III") Error in cbind(M, X) : number of rows of matrices must match (see arg 2) I am not fully sure of the above code, since I am not an expert in R. Can you please correct them showing the correct R code? To the experiment was performed by two groups of listeners: musicians and non-musicians. I created two plots of the results, on for the groups of musicians and the other for the group of non-musicians: https://dl.dropbox.com/u/3288659/exp2_musicians.pdf https://dl.dropbox.com/u/3288659/exp2_non_musicians.pdf Finally, I was not able to find any post hoc test to apply to the result of the MANOVA in case of a significant main effect. Any suggestion? Thanks in advance Best regards #### GretaGarbo ##### Human Urk, Your text is to looooong, and I and many other are to lazy to read it all. A problem with this forum format is that all first-text get very narrow margins (for some reason that I don’t know why). I will coy your text and insert it below and we will se if it is more readable. (I hope you don’t mind. Please forgive me for manipulating – but not changing! – your text.) You can highlight your code and click on a little “code symbol” to make your code more visible. I will do that with your code. Below is frodo.jedis text: “Hello, I need an help in performing a MANOVA in R, but I encountered some problems both in the design and in the synthax with R. I conducted a listening experiment in which 16 participants had to rate the audio stimuli along 5 scales representing an emotion (sad, tender, neutral, happy and aggressive). Each audio stimulus was synthesized in order to represent a particular emotion. Participants had to move 5 sliders each of which corresponded to one of the 5 emotions. The sliders range was [0,10] but participants were only informed about the extremities of the sliders (not at all - very much). There was not a force choice, therefore potentially each audio stimulus could be rated with all the scales (e.g. sad = 0.1, tender = 2.5, neutral = 2., happy = 8.3, aggressive = 1.7). There were 40 stimuli, each stimulus was repeated twice, for a total of 80 trials. I want to demonstrate that the created stimuli were actually correctly classified in the corresponding emotion. For example I expect that happy sounds result in happy ratings by participants and that these happy ratings are greater than the other 4 responses. To analyze the data I want to use a MANOVA with repeated measures. For this purpose I would like to use the audio stimulus as independent variable having 40 levels, while the 5 responses as dependent variables. Since each individual has been measured twice, I include a within-subjects factor for trial number. However, with 40 levels I would have 39 degrees of freedom, that with only 16 participants is not appropriate. For this reason I have also grouped the audio stimuli by their type. So my independent variable could be Trial_type, having 20 levels. Unfortunately, reducing in this way is still too few for 16 participants. Therefore my idea is to perform a MANOVA not on the whole table, but separately for each subset defining an emotion. In this way I would have just 4 lvels. My question is: is this a correct approach to analyze data? Or it is better to use other strategies? For example, looking at the following .csv table which can be downloaded here: https://dl.dropbox.com/u/3288659/Res...st_Grouped.csv I create the subset for emotion Sad, and then I try to perform the MANOVA with repeated measures on it: Code: Sad <- subset(scrd, Emotion == "Sad") Code: model.emotions<-lm(cbind(Sad,Tender,Neutral,Happy,Aggressive) ~ Trial_type,data=scrd) idata<-data.frame(scrd$Trial_number)
aov.emotions<-anova(model.emotions,idata=idata, idesign=~ Trial_type, type="III")
Unfortunately I get the following error which I am not able to solve:

Code:
> aov.emotions<-anova(model.emotions,idata=idata, idesign=~Trial, type="III")
Error in cbind(M, X) : number of rows of matrices must match (see arg 2)
I am not fully sure of the above code, since I am not an expert in R. Can you please correct them
showing the correct R code?

To the experiment was performed by two groups of listeners: musicians and non-musicians. I created
two plots of the results, on for the groups of musicians and the other for the group of non-musicians:
https://dl.dropbox.com/u/3288659/exp2_musicians.pdf
https://dl.dropbox.com/u/3288659/exp2_non_musicians.pdf

Finally, I was not able to find any post hoc test to apply to the result of the MANOVA in case of
a significant main effect. Any suggestion?