[R-sig-eco] Unbalnced nested ANOVA

Kingsford Jones kingsfordjones at gmail.com
Wed Dec 17 23:39:46 CET 2008


Stephen,

Assuming normally distributed errors (and random effects) you can fit
unbalanced random effects models using REML via either lmer in the
lme4 package or lme in the nlme package.  The lme4 package also
provides means of fitting models with non-normal errors, whereas nlme
provides means of structuring error covariance matrices.  If you're
assuming both factors are random your hypotheses will be stated in
terms of the variance components (e.g. H0: region-to-region variance
is zero) and the types of sums of squares issue is not relevant.
Realize that with only 4 regions you will essentially be estimating a
variance from a sample size of 4.

lme code:

lme(resp ~ 1, random = ~1|region/site)

lmer code:

lmer(resp ~ 1 + (1|region/site)

hope it helps,

Kingsford Jones

On Wed, Dec 17, 2008 at 1:05 PM, Stephen Cole <swbcole at gmail.com> wrote:
> Hello R help
>
> I have read over many of the help threads on the regular r help
> archive and must admit i am still confused.
>
> The data set i wish to analyze is a 2 level nested design with both
> factors random.
>
> Response variable: Density of barnacles
>
> Explanatory one: Region ( 4 regions)
> Explanatory two: Site nested within region (this is where the
> unbalance is...... 3 regions have 6 sites each, 1 region has 3 sites)
>
> The hypothesis I wish to test; Is there a difference among regions in
> density, and are there differences among sites nested within region.
>
> I know that i shouldn't (can't) use the aov function as i have read in
> the help files that it can not deal with unbalanced designs.  So i
> guess what i need to do is use the lm function, however i am unsure
> what to do with the type II or III sums of squares.  I realize that
> this decision is dictated by my hypothesis but what i dont know is
> which type my hypothesis dictates.  there seems to be an issue with
> interaction terms and order of factors in the model.  However neither
> of these issues appliy to my data (at least i dont think so).
>
> What i would really like by way of help is a guide to some sort of
> reference i can use to A) learn about the issue, and B) cite as the
> reason that i can analyze an unbalanced design as the work I am doing
> will at some point be submitted for publication ( I hope).
>
> Thanks for any help and advice in advance.
>
> Stephen Cole
> Graduate Student
> Marine Ecology Lab
> STFX
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list