[R] Getting Sphericity Tests for Within Subject Repeated Measure Anova (using "car" package)

John Fox jfox at mcmaster.ca
Wed Jan 4 16:09:29 CET 2012


Dear Max,

I'm having a little trouble following what you did and am also confused by the subject of your posting. Is this a response to another message? Is it really about getting sphericity tests?

In addition:

(1) Why are you adding together the response matrices cbind(umsatz_t1, umsatz_t2, umsatz_t3, umsatz_t4) and cbind(ebitda_t1, ebitda_t2, ebitda_t3, ebitda_t4)?

(2) From the names of the responses, I imagine that you have two, crossed, repeated-measures factors: umsatz vs. ebita, and times 1 through 4. If that's correct, then the intra-subject data should look like

  idata3 <- data.frame(
    condition=rep(c("umsatz", "ebita"), each=5), 
    time=ordered(rep(1:5, 2)))

and the intra-subject design should be ~condition*time.

Best,
 John

--------------------------------
John Fox
Senator William McMaster
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox




> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of maximilian.mueller
> Sent: January-03-12 9:36 PM
> To: r-help at r-project.org
> Subject: Re: [R] Getting Sphericity Tests for Within Subject Repeated
> Measure Anova (using "car" package)
> 
> Hello everyone,
> 
> I am also trying to do within subjects repeated measures anova
> followed by the test of sphericity (see sample dataset attached below)
> and I am facing some problems.
> 
> I tried to assign the example to my research question, but could not
> really solve it.
> 
> Here is the syntax:
> 
> > options(contrasts=c("contr.sum", "contr.poly"))
> > read.csv2("test21.csv") -> dat3
> > mod3 <- lm(cbind(umsatz_t1, umsatz_t2, umsatz_t3, umsatz_t4) +
> > cbind(ebitda_t1, ebitda_t2, ebitda_t3, ebitda_t4)
> + 	~ 1, data=dat3)
> > idata3 <- data.frame(Umsatz=factor(1:4), EBITDA=factor(1:4))
> > aov3 <- Anova(mod3, idata=idata3, idesign= ~Umsatz+EBITDA,
> type="III")
> Fehler in check.imatrix(X.design) :
>   Terms in the intra-subject model matrix are not orthogonal.
> > summary(aov3, multivariate=F)
> 
> with the data set  "dat3"
> 
> > dat3
>     umsatz_t1  umsatz_t2  umsatz_t3  umsatz_t4  ebitda_t1  ebitda_t2
> ebitda_t3
> 1  0.10239021 0.18241379 0.28875806 0.28875806 0.07622154 0.05543311
> 0.06776469
> 2  0.10239021 1.21769038 0.05840222 0.05840222 0.04794192 0.04642960
> 0.03727069
> 3  0.05124775 0.65373713 0.25976771 0.25976771 0.04794192 0.04435191
> 0.03167950
> 4  0.10239021 0.18241379 0.28875806 0.28875806 0.07622154 0.05543311
> 0.06776469
> 5  0.10239021 1.21769038 0.05840222 1.21769038 0.04794192 0.04642960
> 0.03727069
> 6  0.06776469 0.28875806 0.06776469 0.65373713 0.07622154 0.18241379
> 0.10239021
> 7  0.03727069 0.05840222 0.03727069 0.18241379 0.04794192 0.25976771
> 0.04794192
> 8  0.03727069 0.25976771 0.06776469 1.21769038 0.04557920 0.65373713
> 0.07622154
> 9  0.06776469 0.28875806 0.06776469 0.28875806 0.07622154 0.18241379
> 0.04794192
> 10 0.03727069 0.05840222 0.03727069 0.05840222 0.04794192 0.04642960
> 0.04557920
> 11 0.25976771 0.05543311 0.03727069 0.05543311 0.07622154 0.06776469
> 0.03167950
> 12 0.28875806 0.04642960 0.07622154 0.04642960 0.04794192 0.03727069
> 0.06776469
> 13 0.05840222 0.18241379 0.04794192 0.25976771 0.07622154 0.03167950
> 0.03727069
> 14 0.06776469 1.21769038 0.07622154 0.28875806 0.04794192 0.06776469
> 0.04642960
> 15 0.03727069 0.28875806 0.03727069 0.03727069 0.06776469 0.03727069
> 0.04435191
> 16 0.04794192 0.04642960 0.04557920 0.04557920 0.06776469 0.28875806
> 0.06776469
> 17 0.07622154 0.06776469 0.03167950 0.07622154 0.03727069 0.05840222
> 0.03727069
> 18 0.04794192 0.04642960 0.03727069 0.04435191 0.07622154 0.03167950
> 0.03727069
> 19 0.04794192 0.04435191 0.03167950 0.05543311 0.04794192 0.06776469
> 0.04642960
>     ebitda_t4
> 1  0.04642960
> 2  0.04435191
> 3  0.05543311
> 4  0.04642960
> 5  0.18241379
> 6  0.25976771
> 7  0.04794192
> 8  0.07622154
> 9  0.04794192
> 10 0.04557920
> 11 0.07622154
> 12 0.04794192
> 13 0.04557920
> 14 0.03167950
> 15 0.03167950
> 16 0.65373713
> 17 0.18241379
> 18 0.04557920
> 19 0.03167950
> >
> 
> Thanks four your help...
> 
> Sincerely,
> Max
> 
> 
> 
> -----
> M a x i m i l i a n  M ue l l e r
> 
> PhD-Student
> Department of Business Studies
> Leuphana Universität Lüneburg
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Getting-
> Sphericity-Tests-for-Within-Subject-Repeated-Measure-Anova-using-car-
> package-tp841030p4259642.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list