Learn R Programming

MuMIn (version 1.9.5)

r.squaredGLMM: Pseudo-R-squared for Generalized Mixed-Effect models

Description

Calculate a conditional and marginal coefficient of determination for Generalized mixed-effect models (R$_{GLMM}^{2}$).

Usage

r.squaredGLMM(x, nullfx = NULL)

Arguments

x
a fitted linear model object.
nullfx
optionally, a fitted null model including only intercept and all the random effects of the reference model.

Value

  • r.squaredGLMM returns a numeric vector with two values for marginal and conditional R$_{GLMM}^{2}$.

Details

For mixed-effects models, R$^{2}$ can be categorized into two types: marginal and conditional. Marginal R$^{2}$ represents the variance explained by fixed factors, and is defined as:

$$R_{GLMM(m)}^{2}= \frac{\sigma_f^2}{\sigma_f^2 + \sum_{l=1}^{u}\sigma_{l}^{2} + \sigma_\epsilon^2}$$

Conditional R$^{2}$ is interpreted as variance explained by both fixed and random factors (i.e . the entire model), and is calculated according to the equation:

$$R_{GLMM(c)}^{2}= \frac{\sigma_f^2 + \sum_{l=1}^{u}\sigma_{l}^{2}}{\sigma_f^2 + \sum_{l=1}^{u}\sigma_{l}^{2} + \sigma_\epsilon^2}$$

where $\sigma_f^2$ is the variance of the fixed effect components, and $\sum \sigma_{l}^{2}$ is the sum of all latex{$u$}{} variance components (group, individual, etc.), and $\sigma_\epsilon^2$ is the residual variance.

References

Nakagawa, S, Schielzeth, H. (2012). A general and simple method for obtaining R$^{2}$ from Generalized Linear Mixed-effects Models. Methods in Ecology and Evolution: (online) doi:10.1111/j.2041-210x.2012.00261.x

See Also

summary.lm, r.squaredLR

Examples

Run this code
library(lme4)
data(Orthodont, package = "nlme")

fm1 <- lmer(distance ~ Sex * age + (1 | Subject), data = Orthodont)

r.squaredGLMM(fm1)
r.squaredLR(fm1)
r.squaredLR(fm1, null.RE = TRUE)

Run the code above in your browser using DataLab