简体   繁体   中英

specify random effects in lme4

I would like to ask for your help in specifying the random effects of a model I have been working on in lme4. I have data from a field survey. The objective of the study is to relate wing size (respond variable) with habitat (exploratory variable, categorical variable with 2 levels). We performed a paired design by sampling 50 individuals of 3 species in a simple habitat and the same 3 species (n=50 again) in a complex habitat in a region. We replicated that in 20 regions. I am both interested in the species specific effects and community effects. For running the analyses per species is this model correct?

modela<-lmer(Wingsize~Habitat+(1|Region))

For community wide effects is this model correct?

modelb<-lmer(Wingsize~Habitat+(1|Region/Habitat/Species))

Schematic (from on-hold CrossValidated question :

Short Dataset

I would not use Habitat both as fixed effect and group level effect, because then you have a "perfect" correlation between group level and fixed effects. Rather, I would use Habitat only as fixed effect:

modelb<-lmer(Wingsize~Habitat+(1|Region/Species))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM