I have been searching for the answer online without success.I have a full factorial design with temperature (Cold and Warm), predator (Yes/No), and aphid species (A, B and C) as fixed effects (12 treatments in total). I did 3 replicates of each treatment at 5 different dates (a total of 15 replicates per treatment). This was a lab experiment performed with only two growth chambers (corresponding each to one temperature) which were inverted at each date (for example: Date 1, chamber 1: Cold, chamber 2: Warm; Date 2, chamber 1: Warm, chamber 2: Cold;....). The response variable is aphid abundance.

Date is a random effect but I am not sure how should I deal with the temperature/chamber component and also the fact that predator and species are nested in the temperature regime:

m1.nlme = lme(aphid ~ temperature*predator*species,
              random = ~ 1|date, data = My.Data)

m2.nlme = lme(aphid ~ temperature*predator*species,
              random = ~ 1|date/temperature, data = My.Data)

m3.nlme = lme(aphid ~ temperature*predator*species,
              random = ~ 1|date/temperature/predator/species, data = My.Data)

I am a bit confuse with all the things I red online and do not know which one of these models is the best for these data?

  • $\begingroup$ In model 2 and three you model some variables as both fixed and random (e.g. temperature). What do you think are the random effects and how are they related (nested)? Chamber and date? $\endgroup$
    – Ivo
    Commented Dec 2, 2015 at 10:25
  • $\begingroup$ In models two and three, the random effect would be date + interactions between date and temperature (for model 2), predator, and species (for model 3). $\endgroup$
    – Arno
    Commented Dec 2, 2015 at 11:17
  • $\begingroup$ OK. First, a variable is either a fixed or a random effect, not both. With a mixed model you account for structural dependencies that result from the design in the study. I would say that date and chamber are both random effects. I would also say that you are trying to find the effect of temperature, predator and species so they are fixed effects. I can't come up with a reason to model interaction between date and temperature (mainly because one is random and the other is fixed). $\endgroup$
    – Ivo
    Commented Dec 2, 2015 at 14:01

1 Answer 1


So, you want to model one effect, date (see comments below). And three predictors. Based on what I know now I would say this is the way to go:

m.nlme = lmer(aphid ~ temperature*predator*species + 1|date,
             data = My.Data)

This model assumes no nested structure. What part of the design makes you want to use a nested structure?

  • 1
    $\begingroup$ Thanks for your answer. yes it seems that it is the correct model. lme is not working nicely for crossed random effects but the function lmer is able to handle this gm1 <- lmer(aphid~ temperature*predator*species+(1|date)+(1|chamber),data = My.Data) I have another data set for which we did not inverted growth chamber between each date. So 1 chamber = 1 temperature. What would be the correct model in this case? only date as a random effect? $\endgroup$
    – Arno
    Commented Dec 2, 2015 at 14:43
  • $\begingroup$ Hmm. Yes. In that case temperature and chamber are not distinguishable. So if you find and effect for temperature it possibly (partly) explained by the random chamber effect. $\endgroup$
    – Ivo
    Commented Dec 2, 2015 at 15:18
  • $\begingroup$ Yes I agree but, in this case, would you still keep chamber as a random effect as in gm1 above? or drop it as it not very informative? Thanks a lot for your answers. it's really helping me. $\endgroup$
    – Arno
    Commented Dec 2, 2015 at 15:35
  • $\begingroup$ I'm not a 100% sure on this point. I expect that if you include the random effect for chamber the fixed temperature effect would still be estimable and the random effect will have less variance than when you would not include temperature. On the other hand, you can run the model (with both effects) but the interpretation will just be limited due to the design of the study. You might want to start another topic for this question. $\endgroup$
    – Ivo
    Commented Dec 3, 2015 at 16:24
  • $\begingroup$ A similar question was asked here: stats.stackexchange.com/questions/71587/… $\endgroup$
    – Ivo
    Commented Dec 3, 2015 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.