[R] Sphericity for a repeated measure ANOVA with whithin and between subjects design, using R

John Fox jfox at mcmaster.ca
Mon Jul 6 18:17:35 CEST 2015


Dear Angelo,

One way to do this is with the Anova() function in the car package; see the
following article in the R Journal:

@Article{RJournal:2013-1:fox-friendly-weisberg,
  author       = {John Fox and Michael Friendly and Sanford Weisberg}, 
  title        = {Hypothesis Tests for Multivariate Linear Models Using the
{car} Package}, 
  journal      = {The R Journal},
  year         = 2013,
  volume       = 5,
  number       = 1,
  pages        = {39--53},
  month        = jun,
  url          =
{http://journal.r-project.org/archive/2013-1/RJournal_2013-1_fox-friendly-we
isberg.pdf}

I hope this helps,
 John


-----------------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/



> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of
> angelo.arcadi at virgilio.it
> Sent: July-06-15 10:05 AM
> To: r-help at r-project.org
> Subject: [R] Sphericity for a repeated measure ANOVA with whithin and
> between subjects design, using R
> 
>  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]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the R-help mailing list