# [R] help about 2 way anova and tukey test

Sarti Maurizio sarti.m at irea.cnr.it
Thu May 24 15:04:51 CEST 2007

```Dears members of R list,
I have a technical question about conducting 2 way analysis of the variance
(ANOVA) for repeated measures followed tukey test using R.
my data are:
There were 3 subj in all and 3 repeated measures for every time and therapy
therapy = a,b,c
time    = t1,t2,t3
subj    = 1,2,3

subj	therapy	t0	t1	t2
1	a	80.5	82.2	54.23
2	a	84.9	85.6	56.83
3	a	81.5	81.4	54.30
1	b	83.8	95.2	59.67
2	b	83.3	94.3	59.20
3	b	86	91.5	59.17
1	c	80.7	80.2	53.63
2	c	89.4	80.1	56.50
3	c	91.8	86.4	59.40

the code that I use is:

rm(list=ls(all=TRUE))
attach(dati)
subj<- c( 1: 9, 1: 9,1:9)
therapy<- factor( c( rep(" a", 3), rep(" b", 3), rep(" c", 3),
rep(" a", 3), rep(" b", 3), rep(" c", 3),
rep(" a",3), rep(" b", 3), rep(" c", 3)))

time<- factor( c( rep(" t0", 9), rep(" t1", 9),rep(" t2", 9)))
weight<- c( t0,t1,t2)

time <- factor( time)
therapy <- factor( therapy)
subj <- factor( subj)
summary( fm1<-aov( weight~time*therapy))
fm1Tukey=TukeyHSD(fm1,"therapy",ordered = TRUE) ; fm1Tukey
fm1Tukey=TukeyHSD(fm1,"time",ordered = TRUE) ; fm1Tukey
fm1Tukey=TukeyHSD(fm1,"time:therapy",ordered = TRUE) ; fm1Tukey

My question is - is that the correct way to do it??
Very much obliged for your kind response
Maurizio

******************************************************************************
Maurizio Sarti, PhD
IREA - CNR
via Diocleziano,328 I-80124 Napoli (Italy)
tel:+39-(0)81-5707999-(0)81-5704945  fax:+39-(0)81-5705734
cell:+39-3204397891
******************************************************************************
e-mail: sarti.m a irea.cnr.it website: http://www.irea.cnr.it

```