[R] ANOVAs per grouping variable

Smit, A, Albertus, Dr ajsmit at botzoo.uct.ac.za
Thu Oct 31 09:56:47 CET 2002


Dear all

I have a question regarding repeating a series of nested ANOVAs. 
The model is:

fit <- aov(response ~ treatment + plot/rep)

Treatment has three levels, there are three plots and each plot has 
four replicates. Now, the experiment was also repeated six times 
during the year. Ideally I would have liked to include sampling time 
(month) as an additional factor in the analysis, but this is not possible 
as the repeated measures are not independent and I don't have the 
needed replicates to evaluate variation within individual months. So, 
the next best option is separate ANOVAs for each month.

Since I cannot be bothered re-typing the above model for each month 
(I have many such analyses to do), is there an easy way to 
'automatically' repeat the analysis for each level of sampling time, 
maybe using one of the apply() functions, or alternatively, the less 
efficient for() statement? I have looked at the help files - it is easy with 
functions such as mean(), but more complicated functions seem 
(giving my limited experience with R) somewhat more tricky.

Just as an aside: has anyone computed Tony Underwood's ANOVA 
example given on pages 247 (the data) and 256 (the results) of 
'Experiments in Ecology, 1997'? My results (in R) is different from that 
given in the book. The model used is

aov(fec ~ treat + plot/rep).

Why? Or is my model not the same used by Underwood?

Thanks in advance,
Albertus


Dr. Albertus J. Smit
Department of Botany
University of Cape Town
Private Bag Rondebosch
7700
South Africa
Tel. +27 21 689 3032
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list