R2GLMER: GLMER Pseudo-R2

View source: R/R2GLMER.R

R2GLMERR Documentation

GLMER Pseudo-R2

Description

Calculates psuedo-R2 values for GLMER and LMER models

Usage

R2GLMER(model)

Arguments

model

A mixed-effects model, of class 'lmerMod' or 'glmerMod'

Details

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)

Value

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

Author(s)

Tim Newbold <t.newbold@ucl.ac.uk>

References

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.

Examples

# 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)


timnewbold/StatisticalModels documentation built on Aug. 25, 2023, 4:58 p.m.