[R] One-way repeated measures ANOVA

John Fox jfox at mcmaster.ca
Fri Nov 18 19:32:21 CET 2011


Dear Varina,

I think that you may be confusing the Anova() function in the car package
(which takes an idesign argument) with the standard R anova() function.

I hope this helps,
 John

--------------------------------
John Fox
Senator William McMaster
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://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 Varina Crisfield
> Sent: November-18-11 10:11 AM
> To: r-help at r-project.org
> Subject: [R] One-way repeated measures ANOVA
> 
> Hi all,
> 
> I'm trying to run a repeated measures ANOVA on some univariate
> ecological data that was collected over two growing seasons. I ran the
> test using the methodology found on this website:
> 
> http://rtutorialseries.blogspot.com/2011/02/r-tutorial-series-one-way-
> repeated.html
> 
> Upon running the actual ANOVA I got this error message:
> 
> "> rmanova=anova(yearmodel, idata=yearframe, idesign=~yearfactor)
> Warning message:
> In function (object, ..., test = c("Pillai", "Wilks", "Hotelling-
> Lawley",  :
>   models with response "NULL" removed because response differs from
> model 1"
> 
> And the p-values I get in the anova summary are completely off, judging
> by the t-tests I did on the same data.
> 
> The dataset is small (n=6) and was arranged so that the data from the
> two different years was arranged in two columns ("2010", "2011).
> 
> I've pasted the rest of the code below for reference. I'd appreciate
> any suggestions as to what the issue here is!
> 
> Thanks,
> Varina
> 
> transect=read.csv("Transect data.csv")
> 
> attach(transect)
> 
> 
> replicates=c(1,2)
> 
> yearfactor=as.factor(replicates)
> 
> yearframe=data.frame(yearfactor)
> 
> yearbind=cbind(transect$TP10, transect$TP11)
> 
> yearmodel=lm(yearbind~1)
> 
> 
> rmanova=anova(yearmodel, idata=yearframe, idesign=~yearfactor)
> 
> summary(rmanova)
> 
> 	[[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