[R] repeated measure one way anova

Dieter Menne dieter.menne at menne-biomed.de
Tue Oct 28 08:19:54 CET 2008


JohnLi <jli136 <at> site.uottawa.ca> writes:
> I am a new comer for Statistics R. I am using R for one way repeated
> measure anova, for example, on the following data consisting of three
> groups.
> 
> 
> c2	c3	c4
> 85.83	75.86	84.19
> 85.91	73.18	85.9

-- Arrange your data in the "long form". Do it by hand, or use function pack, or
reshape, or package reshape.

(Assuming these are times. If these are categorical variables, better use
strings as column descriptors)



subj time conc    (do not use t or c as variable name, these are 
              "well-known functions" in R) 
A     2    85.83
A     3    75.86
A     4    84.19
B     2    85.91
....

Use package nlme, function lme. It might be a bit of an overkill for the simple
case, but always worth the effort when things get more complex

libary(nlme)
summary(lme(c~time, random=~1|subj,data=mydata)

Dieter



More information about the R-help mailing list