R2GLMER | R Documentation |
Calculates psuedo-R2 values for GLMER and LMER models
R2GLMER(model)
model |
A mixed-effects model, of class 'lmerMod' or 'glmerMod' |
Calculated conditional (i.e. variance explained by fixed and random effects) and marginal (fixed effects only) R2 values, using the method proposed by Nakagawa & Schielzeth (2013)
conditional: the conditional R2 value, i.e. the variance explained by fixed and random effects marginal: the marginal R2 value, i.e. the variance explained by the fixed effects
Tim Newbold <t.newbold@ucl.ac.uk>
Nakagawa, S. & Schielzeth, H. (2013). A general and simple method for obtaining R2 from generalized linear mixed-effects models. <i> Methods in Ecology & Evolution</i> <b>4</b>: 133-142.
# Load example data (site-level effects of land use on biodiversity from the PREDICTS database)
data(PREDICTSSiteData)
# Run a model of species richness as a function of land use, human population density
# and distance to nearest road (with an interaction between human population density
# and road distance)
m1 <- GLMER(modelData = PREDICTSSites,responseVar = "Species_richness",fitFamily = "poisson",
fixedStruct = "LandUse",randomStruct = "(1|SS)+(1|SSB)+(1|SSBS)",REML = TRUE)
# Perform test for over-dispersion
R2GLMER(m1$model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.