[R] nested, unbalanced anova

Spencer Graves spencer.graves at structuremonitoring.com
Sun Jan 6 13:35:43 CET 2013


On 1/6/2013 12:45 AM, peter dalgaard wrote:
> On Jan 6, 2013, at 04:00 , Pfeiffer, Steven wrote:
>
>> Hello,
>> For an experiment, I selected plots of land within a forest either with
>> honeysuckle or without honeysuckle.  Thus, my main factor is fixed, with 2
>> levels: "honeysuckle present"(n=11) and "honeysuckle absent"(n=8).
>>
>> Within each plot of land, I have a "trenched" subplot and an "untrenched"
>> subplot.
>>
>> Within each subplot of every plot, I measured soil moisture.  Now I need to
>> do a nested Anova to compare the soil moisture values between treatments.
>> I don't really want to discard some data to make the sample sizes
>> balanced.
>>
>> Does anyone know how to do a nested, unbalanced Anova in R?
> As far as I can tell, this is still an orthogonal design, so just proceed as usual. You're not in real trouble unless you have plots with one of the subplots missing. The whole thing will boil down to an analysis of the within-plot differences.
>
> Just avoid things like Type-III sums of squares (base R won't do them, but popular add-ons will) because they get it wrong when cell counts are unequal.

       Plot is  a random effect.  Honysuckle, trenched, and moisture are 
fixed.  You may also wish to consider using either the nlme or lme4 
packages, though they may not be needed "unless you have plots with one 
of the subplots missing", as Prof. Dalgaard indicated. Pinhiero and 
Bates (2000) Mixed-Effects Modeling in S and S-Plus (Springer) is the 
best book I know on the subject.  The nlme package contains script files 
with names like ch01.R containing R code to work all the examples in the 
book;  system.file('scripts', package='nlme') will give you the full 
path to where it is installed.  These are necessary, because the R 
implementation contains a very few subtle changes from what is in the 
book.  There is also an r-sig-mixed-models at r-project.org email list that 
may interest you.  I have not used this in years, and I would expect 
that people on this email list could help you with more current 
information on what's available.


       Hope this helps.
       Spencer Graves




More information about the R-help mailing list