0

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,
              method="REML",
              random = ~ 1|date, data = My.Data)

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

m3.nlme = lme(aphid ~ temperature*predator*species,
              method="REML",
              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?

amoeba
  • 104,745
Arno
  • 11
  • 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? – Ivo Dec 02 '15 at 10:25
  • 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). – Arno Dec 02 '15 at 11:17
  • 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). – Ivo Dec 02 '15 at 14:01

1 Answers1

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?

Ivo
  • 421
  • 1
    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~ temperaturepredatorspecies+(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? – Arno Dec 02 '15 at 14:43
  • 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. – Ivo Dec 02 '15 at 15:18
  • 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. – Arno Dec 02 '15 at 15:35
  • 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. – Ivo Dec 03 '15 at 16:24
  • A similar question was asked here: http://stats.stackexchange.com/questions/71587/can-a-variable-be-a-fixed-effect-and-random-effect-variable-at-the-same-time – Ivo Dec 03 '15 at 16:33
  • Thanks for the link. I understand from this webpage that it is best to have it either fixed or random but not both. For a confirmation, I tried with chamber as random with lmer and it's producing warnings: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Hessian is numerically singular: parameters are not uniquely determined – Arno Dec 04 '15 at 11:02
  • +1 to prevent this thread being automatically bumped to the homepage all the time. However, this answer has two problems. First, one should use lmer and not lme for crossed random effects, as already discussed above in the comments (I suggest you edit accordingly). Second, chamber has only two levels; I am not sure it makes any sense to model it as a random effect. Usual recommendation is to only use random effect when the factor has at least 5 levels or more. Two is extreme. This might have caused the error messages reported by @Arno above. – amoeba Jun 15 '17 at 20:18