Hi, I am having difficulties in running a mixed model. The question is like this:
A researcher observes variation in wing size in a beetle species in South-America and wants to know whether wing size is associated to altitude. He therefore collects and measures beetles along an altitudinal gradient on several mountains (at 6 different altitudes: 150m, 300m, 450m, 600m, 750m and 900m). At each altitude he samples 2 patches and collects 6 beetles in each patch. In total he samples 3 such mountains, thus 216 individuals in total. In addition, he determines the sex (male vs female) of each beetle. Finally, he repeats the entire sampling design in Africa for the same species.
The researcher asks you to analyze his data set and to report to him whether altitude affects wing length in this species or not.
So the fixed effects are altitude, sex and continent;
random effects: Patch, mountain.
The data is something like this:
So, I created the model like this:
bett.lmm<-lmer(length~altitude.f+sex+continent+(1|Patch:mountain)+(1|mountain), data=bett)
Am I correct about this?