Takes the form of: y ~ env1 + (1|site) 

Where y is the trait response variable, env1 is an environmental variable (which can be categorical or continuous) related to where the trait was measured, and (1|site) is a random effect where the intercept varies by ‘site but the slope is constant. 

 

One of the main advantages of using a GLMM is to account for pseudo-replication that occurs when measurements are nested.  For example, if there have been multiple species measured at the same site, it would inflate the importance of the environmental variables measured at that site if we included all the measures within your model. This kind of approach requires large enough sample sizes to have multiple data points for each category of your random effect. 

 

 

In this graph from here, we can imagine the y-axis being a species trait that when measured varies between zero and 23mm.  Then imagine the x-axis representing an environmental variable measured at each site that varies between –1.5 and 2.5.  The different colours could represent different sites, and we expect individuals measured at the same site not to be independent from one another.  We expect environmental variable measurements and species traits to be related to one another at each site.  One way to deal with this, is to take average measurements at each site, but it is better to retain all the data, and account for the nested data structure with a GLMM.  In the kind of GLMM available on EcoCommons we use random effects which allow the intercept of random variables to vary, but keep the slope the same for each category of the random effect variable. Note, random effects are always categorical, and account for nested structures in data.  It is possible to have random effects that use a fixed intercept but allow the slopes to vary and it is also possible to use random effects where both the intercept and slope vary.  However, these two options are not currently available within this EcoCommons module. In this module, we only allow slopes to vary and for slopes to be the same i.e. y ~ env1 + (1|site) in R. Continuous variables can be reclassified into ordinal classes to be used as a random effect.  For example, if traits are thought to vary by latitude, the continuous latitude variable can be transformed into 10-degree groupings of latitude.