[R] lme help configuring random effects

Ben Bolker
Mon, 01 Oct 2012 12:46:41 -0000

Julie Lee-Yaw <julleeyaw <at> yahoo.ca> writes:


>

[snip]

> I am trying to run a mixed effects model in R using the lme
> package. My experiment is such that I am interested in the effects
> of Temperature (2 levels) and Species (3 levels) on Growth. I
> collected individuals from three populations within each
> species.?Because?individuals within a population are potentially
> more similar to each other than individuals among populations, I
> want to include population as a random factor in my model.?

 You may have some practical difficulties incorporating a random
effect with only three populations ...


> I would have thought that I would structure the model as follows:?
> z<-lme(Growth~Temp*Species, random=~1|Species/Population)?
> But the summary for this model includes NAs (e.g. for two of the species).?
> I've considered a model such as?

>  z<- lme(Growth~Temp*Species,random=~1|Population)?

I think you need

  z <- lme(Growth~Temp*Species, random=~1|Species:Population)

 Your specification (Species/Population) expands to Species+
Species:Population , which ends up including Species as both
a random and a fixed factor.

  You probably don't have the data, but in principle you
should consider  random=~Temp|Species:Population (see a paper
by Schielzeth on incorporating treatment-by-block interactions)

[snip]

> I'm also confused as to the naming of populations.
> Currently I've got the populations named 1,2,3,4,5
> ...9. Should I?be?naming them A1,A2,A3, B1,B2,B3, C1,C2, C3
> (where the letters represent different
> species)? When does that matter??

  This is the difference between "implicit" and "explicit"
nesting.  In general naming them A1, ... C1, ... is better,
because it reduces the probability of making mistakes.

  http://glmm.wikidot.com/faq may be useful.
  Further questions should probably go to the r-sig-mixed-models
mailing list.