[R] Repeates Measures MANOVA for Time*Treatment Interactions

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Nov 15 19:55:18 CET 2005


Jarrett Byrnes <redbeard at arrr.net> writes:

> Dear R folk,
> 	First off I want to thank those of you who responded with comments for 
> my R quick and dirty stats tutorial.  They've been quite helpful, and 
> I'm in the process of revising them.  When it comes to repeated 
> measures MANOVA, I'm in a bit of a bind, however.  I'm beginning to see 
> that all of the documentation is written for psychologists, who have a 
> slightly different mind-set behind their experiments than, say, an 
> ecologist, who is interested in the effects of time per se, and not 
> just the effects of a treatment.  For example, here's my dataset, say, 
> looking at plant height in cm with and without fertilizer
> 
> Treatment, Time1, Time2, Time3, Time4, Time5
> Fertilizer, 1, 4, 8, 10, 12
> Control,1,2,3,4,5
> Fertilizer,1,8,10,12,20
> Control,1,3,5,6,6
> Fertilizer,2,5,10,20,25
> Control,1,2,4,4,4
> 
> 
> Clearly there is a time*treatment interaction (just eyeballing the 
> dataset)
> 
> My question is, how does one set this up using the anova.mlm approach 
> so that in the end I can write up a table that says
> 
> Treatment
> Time
> Time*Treatment
> 
> I can see from ?anova.mlm how one would get the Treatment effect using 
> something like
> 
> response<-with(my.data, rbind(Time1, Time2, Time3, Time4, Time5))

cbind() would be more like it

> mlmfit<-lm(response~1)
> mlmfit0<-update(mlmfit, ~0)
> anova(mlmfit, mlmfit0, X = ~ Treatment, idata=my.data, test="Spherical")

No... idata is the *intra*-block structure, so it should just be your
five times. I'm somewhat baffled that you're getting away with
supplying a data frame that doesn't have the right number of rows, but
maybe that's because you're supplying the transposed matrix as a
response. 

Try 

mlmfit <- lm(response ~ Treatment)
mlmfit1 <- lm(response ~ 1)
mlmfit0 <- lm(response ~ 0)
 
Then 

anova.mlm(mlmfit, mlmfit1, X=~1, test="Spherical")

tests whether time contrasts depend on treatment, which is the
time*treatment effect.

anova.mlm(mlmfit, mlmfit1, M=~1) 

is the test for overall treatment effect

and 

anova.mlm(mlmfit1, mlmfit0, X=~1, test="Spherical")

is the test for overall time effect.

(If Time1 is a pre-randomization baseline measurement you should
consider including it as a covariate, but that is another matter)

> Although this yields the result that, after correction, it's not 
> significant - perhaps due to the low DF from this simple example
> --
> Analysis of Variance Table
> 
> Model 1: response ~ 1
> Model 2: response ~ 1 - 1
> 
> Contrasts orthogonal to
> ~Treatment
> 
> Greenhouse-Geisser epsilon: 0.3565
> Huynh-Feldt epsilon:        0.4982
> 
>    Res.Df Df Gen.var.      F num Df den Df  Pr(>F)  G-G Pr  H-F Pr
> 1      4     0.43167
> 2      5  1  0.50937 3.7939      4     16 0.02356 0.09620 0.06966
> --
> 
> But, I still want to get my time and time*treatment interactions - what 
> would be the appropriate anova statements here?
> 
> Thanks so much, and hopefully this will resolve the confusion both for 
> myself and for LOTS of other ecology types!
> 
> -Jarrett
> 
> 
> ----------------------------------------
> Jarrett Byrnes
> Population Biology Graduate Group, UC Davis
> Bodega Marine Lab
> 707-875-1969
> http://www-eve.ucdavis.edu/stachowicz/byrnes.shtml
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list