[R] nested design

Ivan Calandra ivan.calandra at univ-fcomte.fr
Wed May 14 14:56:38 CEST 2014


Dear useRs,

I would like to apply a nested ANOVA on my dataset, but I cannot find a 
satisfying answer on how to implement it in R.
For example, fac2 is nested within fac1:
df <- data.frame(resp=rnorm(12), fac1=rep(LETTERS[1:2],each=6), 
fac2=rep(letters[1:6],each=2))

I have found three different ways that are said to be nested designs and 
I cannot understand whether they do the same or not. They all give 
similar results with this example but it might not always be the case.

1) following: 
http://www.personal.psu.edu/mar36/stat_461/nested/nested_designs.html
summary(aov(resp~fac1+fac1/fac2, data=df))

2) following: 
http://www.zoology.unimelb.edu.au/stats/Worksheets/nested%20two-way%20anova%20curdies.pdf
summary(aov(resp~fac1+fac2%in%fac1, data=df))
This notation is very intuitive to me.

3) following: 
http://cran.r-project.org/doc/contrib/Vikneswaran-ED_companion.pdf
summary(aov(resp~fac1+fac1:fac2, data=df))
For me, the ":" specifies the interaction. Is this then analogous since 
in a nested design the levels of fac2 are different in each level of fac1?


So my questions are: Are there differences between these notations? If 
yes, which ones? And then, which notation should I prefer?
And if they are identical, then why are there 3 (or more) ways to do it? 
Is there a reason not to have a single implementation?

Thank you in advance,
Ivan

-- 
Ivan Calandra
University of Franche-Comté
Laboratoire Chrono-Environnement
Bureau ATER -107L
16, Route de Gray
25030 Besançon Cedex, France
ivan.calandra at univ-fcomte.fr
+33 (0) 381 66 20 60
http://chrono-environnement.univ-fcomte.fr/spip.php?article1830



More information about the R-help mailing list