[R] [package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?

John Fox jfox at mcmaster.ca
Wed Feb 18 23:24:36 CET 2009


Dear Tal,

I suppose that the "between" residuals would be obtained, for your example,
by residuals(mod.ok). I'm not sure what the "within" residuals are. You
could apply the transformation for each within-subject effect to the matrix
of residuals to get residuals for that effect -- is that what you had in
mind? A list of transformations is in the element $P of the Anova.mlm
object.

Regards,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: 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 Tal Galili
> Sent: February-18-09 4:04 PM
> To: r-help at r-project.org
> Subject: [R] [package-car:Anova] extracting residuals from Anova for Type
> II/III Repeated Measures ?
> 
> Hello dear R members.
> I have been learning the Anova syntax in order to perform an SS type III
> Anova with repeated measures designs (thank you Prof. John Fox!)
> And another question came up: where/what are the (between/within)
residuals
> for my model?
> 
> 
> 
> ############  Play code:
> 
> 
> phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)),
>     levels=c("pretest", "posttest", "followup"))
> hour <- ordered(rep(1:5, 3))
> idata <- data.frame(phase, hour)
> idata
> 
> mod.ok <- lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5,
>                      post.1, post.2, post.3, post.4, post.5,
>                      fup.1, fup.2, fup.3, fup.4, fup.5) ~
>  treatment*gender,
>                 data=OBrienKaiser)
> av.ok <- Anova(mod.ok, idata=idata, idesign=~phase*hour)
> 
> 
> summary(av.ok, multivariate=FALSE)
> 
> ## Univariate Type II Repeated-Measures ANOVA Assuming Sphericity
> ##
> ##                                  SS num Df Error SS den Df       F
>  Pr(>F)
> ## treatment                   211.286      2  228.056     10  4.6323
>  0.037687
> ## gender                       58.286      1  228.056     10  2.5558
>  0.140974
> ## treatment:gender            130.241      2  228.056     10  2.8555
>  0.104469
> ## phase                       167.500      2   80.278     20 20.8651
> 1.274e-05
> ## treatment:phase              78.668      4   80.278     20  4.8997
>  0.006426
> ## gender:phase                  1.668      2   80.278     20  0.2078
>  0.814130
> ## treatment:gender:phase       10.221      4   80.278     20  0.6366
>  0.642369
> ## hour                        106.292      4   62.500     40 17.0067
> 3.191e-08
> ## treatment:hour                1.161      8   62.500     40  0.0929
>  0.999257
> ## gender:hour                   2.559      4   62.500     40  0.4094
>  0.800772
> ## treatment:gender:hour         7.755      8   62.500     40  0.6204
>  0.755484
> ## phase:hour                   11.083      8   96.167     80  1.1525
>  0.338317
> ## treatment:phase:hour          6.262     16   96.167     80  0.3256
>  0.992814
> ## gender:phase:hour             6.636      8   96.167     80  0.6900
>  0.699124
> ## treatment:gender:phase:hour  14.155     16   96.167     80  0.7359
>  0.749562
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> ----------------------------------------------
> 
> 
> My contact information:
> Tal Galili
> Phone number: 972-50-3373767
> FaceBook: Tal Galili
> My Blogs:
> www.talgalili.com
> www.biostatistics.co.il
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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