# Crossed random effects: how do we model multiple reciprocal transplants in lme4?

I saw the previous post on "Crossed vs nested random effects: how do they differ and how are they specified correctly in lme4?" with a very nice descriptive response from @RobertLong (Crossed vs nested random effects: how do they differ and how are they specified correctly in lme4?). We have a crossed design similar to the example of 3 schools crossed with 3 classes, but we have 4 sets of this crossing design. By that I mean we have 4 sets of 3 groups that are fully crossed back into 3 groups. In our case, these are populations of plants coming from different habitats (3 different habitat types, 4 populations of each) and transplanted back into the 3 different habitats. We used this model for e.g., final height:

modfinheight<-lmer(final.height~SOURCE.type+GARDEN.type+SOURCE.type:GARDEN.type+ (1|Origin.site)+(1|Transplant.site),data=datrmna.finalheight,REML=F)

where Origin.site is the population where the plant came from (4 from each type of habitat). Transplant.site is the population where they were planted (4 for each type of habitat) Source.type is the habitat type of the origin (3 levels: beach, marsh, road) Garden.type is the habitat type of the transplant (3 levels: beach, marsh, road)

It seems that we have the same setup as for the crossing example, but we have 4 sets of them. Should this be the way to model the four together? It seems to work, until we try to get components of variance for the random and fixed effects in the same analysis (using partR2). Perhaps we should have both random effects nested within Transplant.group? e.g., (1|Transplant.group) + (1|Transplant.group:Origin.site) + (1|Transplant.group:Transplant.site)

• So the grouping variables Origin.site and Transplant.site have only 4 levels each ? That's not really sufficient for fitting random intercepts since you will be asking the software to estimate variances for 2 normally distributed variables from only 4 observations each. Jun 15, 2021 at 14:11
• Thanks for commenting! There are 12 Origin.sites and 12 Transplant.sites. You are right that there are only 4 of each in each habitat (which is why I thought a nested design was necessary). I was thinking more about it and its a combination of your 2 figures that you gave for nested and crossed designs. You describe the nested as 3 schools with 9 total classes. That is what I have but 4 groups with 12 total origin.sites. But then there is another level below the 12 origin sites with crossed design into the 12 Transplant sites. I revised your figure and posted it to Twitter @ecolepig Jun 16, 2021 at 0:59
• I should add that we also have replicates of individuals from each Origin.site - we started with 75-150 replicates, but had heavy mortality so the final design is between 8-50 for each Origin.site (Total N=396). Jun 16, 2021 at 1:08
• Please can you post the diagram into your question here. Jun 16, 2021 at 10:04
• Sorry I'm not sure how to do that! I looked here: stats.stackexchange.com/editing-help#images, but "CTRL+G to insert an image" doesn't seem to work. Jun 16, 2021 at 11:24

Here we have Transplant.site partially crossed with Origin.site. It also appears that both are nested within Transplant.group, but there are insufficient number of these to fit random interepts for them, so Transplant.group should be a fixed effect.

I would therefore propose the following analysis model:

final.height ~ SOURCE.type * GARDEN.type + Transplant.group + (1|Origin.site) + (1|Transplant.site)


Note that the second proposed model with the following random structure:

(1|Transplant.group) + (1|Transplant.group:Origin.site) + (1|Transplant.group:Transplant.site)


does not make sense because the first term would lead to a software trying to estimate a variance for a normally distributed variable from only 4 observations.

• I like that answer. Maybe this is too naive to ask, but what if we model it without the fixed effect of Transplant.group? I guess we can see how it changes the results. Jun 16, 2021 at 13:20
• Since origin site and transplant sites are nested within levels of Transplant.group, observations in one group are more likely to be similar to each other than observations in other groups. This clustering may lead to non-independence of observations within each group. This is why we would fit random intercepts for groups if we had more of them, but fitting fixed effects also controls for this non-independence. By all means try a model without this, and if there is very little variation within groups, the results will be the same and you could proceed without it, for parsimoneous reasons. Jun 16, 2021 at 13:43
• This is really helpful! Thanks a lot! Is it common or useful to cite this in the manuscript for this data? i.e., with some version of this: Robert Long (stats.stackexchange.com/users/7486/robert-long), Crossed random effects: how do we model multiple reciprocal transplants in lme4?, URL (version: 2021-06-16): stats.stackexchange.com/q/530923 Jun 17, 2021 at 0:03