[R] Repeated Measures Analysis - GLM

Michael Friendly friendly at yorku.ca
Mon Dec 14 17:20:10 CET 2009


To follow up on John's advice:

Start with something like

my.mod <- lm(cbind(OpenR1, OpenR2, OpenR3) ~ AgeClass * Treatment, 
data=my.data)

then read ?Anova to see how to specify idata= and idesign= for the 
repeated factor.

hth,
-Michael

John Fox wrote:
> Dear Ingo,
> 
> One approach would be to use the Anova() function in the car package. See
> ?Anova and in particular the O'Brien and Kaiser example, which is for a more
> complicated repeated-measures design. If you want to get "type-III" tests
> (as opposed to the default "type-II" tests), be careful with the contrast
> coding for the between-subjects factors.
> 
> I hope this helps,
>  John
> 
> --------------------------------
> John Fox
> Senator William McMaster 
>   Professor of Social Statistics
> 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 protonringe
>> Sent: December-13-09 11:29 AM
>> To: r-help at r-project.org
>> Subject: [R] Repeated Measures Analysis - GLM
>>
>>
>> Hello to the R world...
>>
>> I have some problems regarding a GLM - repeated measures analysis.
>>
>> I want to test overall differences between AgeClass and Treatment (between
>> subject) with OpenR1+OpenR2+OpenR3 (repeated measures, within subject).
> The
>> table looks kind like this:
>>
>> AgeClass	Treatment	OpenR1	OpenR2	OpenR3
>> 1	1	0	0	12.63
>> 1	1	12.67	3.83	45.67
>> 1	1	38.46	65.38	75.21
>> 1	1	14.46	0	17.96
>> 1	2	27.83	47.33	66.38
>> 1	2	15.75	0	10.21
>> 1	2	43.96	41.04	51.88
>> 1	2	52.96	55.54	41.58
>> 1	3	43.13	71.25	82.71
>> 1	3	0.25	18.46	27.04
>> 1	3	0.79	21.75	68.38
>> 2	1	0	0	0
>> 2	1	0	0	0
>> 2	1	1.17	18.75	45.67
>> 2	1	0	0	0
>> 2	1	0	0	49.42
>> 2	2	2.13	0	26.63
>> 2	2	0	8.13	23.88
>> 2	2	2.25	0	0
>> 2	2	30.96	25.71	10.92
>> 2	3	33.33	30.71	16.63
>> 2	3	0	20.04	14.88
>> 2	3	24.96	0	3.88
>> .
>> .
>> .
>>
>> I tried several things, for example this:
>>
> aov(?????~(OpenR1*OpenR2*OpenR3*AgeClass*Treatment)+Error(??????/(OpenR1*Ope
> n
>> R2*OpenR3))+(AgeClass*Treatment))
>>
>> I don't really know what response-variable to use, or what the
>> subject-variable is....
>>
>> There is no problem to create the model with SPSS, but for my
> Diploma-Thesis
>> in biology i want to do all the statistics with R...
>>
>> Regards and many thanks in advance....
>>
>> Ingo
>>
>>
>> --
>> View this message in context: http://n4.nabble.com/Repeated-Measures-
>> Analysis-GLM-tp963016p963016.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.
> 


-- 
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    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA




More information about the R-help mailing list