The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Adjusted R² for generalized linear mixed models

Dongwen Luo

R2_model() gives an adjusted coefficient of determination (R²) for linear and generalized linear mixed models by the method of Piepho (2023): the total R² and its fixed and random shares, from one fit. For a GLMM the residual variance on the link scale is chosen from the family and link. It replaces R2_glmm() of predictmeans 1.x, with the same values given as numbers.

library(predictmeans)
data(Body_length)
fm <- lmer(BodyL ~ Treatment + Habitat + Sex + (1 | Population/Container),
           data = Body_length)
R2_model(fm)
#> # Adjusted R2 for mixed models (Piepho)
#>                Total                Fixed               Random 
#>               73.39%               40.09%               33.30% 
#> Container:Population           Population 
#>                5.18%               28.13%

over_disp = TRUE counts an observation-level random effect (one level per observation) as residual variance. method = "nakagawa" gives the R² of Nakagawa and Schielzeth (2013).

The method, and all five examples of Piepho (2023) checked against the paper (Poisson, binary and binomial GLMMs with three links, clinic- and patient-level data, an ordinal model), are in the article Adjusted R² for GLMMs.

References

Piepho, H.-P. (2023). An adjusted coefficient of determination (R²) for generalized linear mixed models in one go. Biometrical Journal, 65(7), e2200290. https://doi.org/10.1002/bimj.202200290

Nakagawa, S. and Schielzeth, H. (2013). A general and simple method for obtaining R² from generalized linear mixed-effects models. Methods in Ecology and Evolution, 4, 133–142.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.