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

Michael Friendly friendly at yorku.ca
Wed Jan 4 15:13:37 CET 2012


On 1/3/2012 9:36 PM, maximilian.mueller wrote:

> 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)

That's because you've defined two identical factor variables.
> idata3<- data.frame(Umsatz=factor(1:4), EBITDA=factor(1:4))

 > idata3 <- data.frame(Umsatz=factor(1:4), EBITDA=factor(1:4))
 > idata3
   Umsatz EBITDA
1      1      1
2      2      2
3      3      3
4      4      4
 >

If your data is a doubly-multivariate design with two repeated variables
Umsatz and EBIDTA crossed with 4 time points each, you might want to look
at the vignette "HE Plots for Repeated Measures Designs" in the heplots 
package for theory and examples

vignette("repeated", package="heplots")

-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list