[R] Sphericity for a repeated measure ANOVA with whithin and between subjects design, using R
angelo.arcadi at virgilio.it
angelo.arcadi at virgilio.it
Mon Jul 6 16:04:58 CEST 2015
Dear List Members,
I need to perform a four-way ANOVA with repeated measures and to
calculate the sphericity for eventual correction of the degree of
freedom of the F ratio.
I have three within subjects factors (Emotion, having 5 levels,
Material, having 4 levels, Shoes, having 2 levels) and a between subject
factor (Musician, having 2 levels). Without considering the sphericity I
use the following formula
aov_SPL = aov(SPL ~ Emotion*Material*Shoes*Musician + Error(Subject/(Emotion*Material*Shoes)), data=scrd)
Unfortunately after having read lot of material online I did not
arrive to a solution about how to calculate for my case the epsilon of
the Greenhouse-Geisser method for degree of freedom adjustment.
I load my data in R with this formula:
scrd<- read.csv(file='/path to data/data.csv',sep=',',header=T)
and this is the structure of the imported table:
> head(scrd)
Subject Material Shoes Emotion H2H H2H_factor SPL_factor SPL_variation SPL Musician Weight Height
1 Subject1 Gravel dress_shoes AGGRESSIVE 468 0.736 11.591 21.283 97.383 no 90 183
2 Subject1 Gravel dress_shoes HAPPY 719 1.129 3.188 10.071 86.171 no 90 183
3 Subject1 Gravel dress_shoes TENDER 1129 1.774 5.114 14.176 90.276 no 90 183
4 Subject1 Gravel dress_shoes SAD 1010 1.587 13.102 22.347 98.447 no 90 183
5 Subject1 Gravel dress_shoes NEUTRAL 736 1.156 3.161 9.995 86.095 no 90 183
6 Subject10 Gravel dress_shoes AGGRESSIVE 635 0.998 15.849 24.000 100.100 yes 70 178
>
I noticed that in the car package there is the Anova() function that
comes with the Maulchy's sphericity test, but it does not take as an
input a model generated with aov(). I need to use lm() instead, but
since
I am not really proficient in R I do not know how to use the lm()
starting from the loaded data and how to use Anova(). In addition, being
a mixed design involving within and between subjects factors I wonder
if Anova() is the most appropriate function to use for my case.
Is there anyone who could provide me with the R code to calculate the
Maulchy's test and the epsilon of Greenhouse-Geisser for my case?
Thank you in advance
Best
Angelo
[[alternative HTML version deleted]]
More information about the R-help
mailing list