Learn R Programming

rsq (version 2.7)

rsq.glmm: R-Squared for Generalized Linear Mixed Models

Description

Calculate the variance-function-based R-squared for generalized linear mixed models.

Usage

rsq.glmm(fitObj,adj=FALSE)

Value

R_M^2

proportion of variation explained by the model in total, including both fixed-effects and random-efffects factors.

R_F^2

proportion of variation explained by the fixed-effects factors.

R_R^2

proportion of variation explained by the random-effects factors.

Arguments

fitObj

an object of class "glmerMod", usually, a result of a call to glmer or glmer.nb.

adj

logical; if TRUE, calculate the adjusted R^2.

Author

Dabao Zhang, Department of Epidemiology and Biostatistics, University of California, Irvine

Details

There are three types of R^2 calculated on the basis of observed response values, estimates of fixed effects, and variance components, i.e., model-based R_M^2 (proportion of variation explained by the model in total, including both fixed-effects and random-efffects factors), fixed-effects R_F^2 (proportion of variation explained by the fixed-effects factors), and random-effects R_R^2 (proportion of variation explained by the random-effects factors).

References

Zhang, D. (2017). A coefficient of determination for generalized linear models. The American Statistician, 71(4): 310-316.

Zhang, D. (2022). Coefficients of determination for mixed-effects models. Journal of Agricultural, Biological and Environmental Statistics, 27: 674-689.

See Also

vresidual, rsq, rsq.v.

Examples

Run this code
require(lme4)
data(cbpp)
glmm1 <- glmer(cbind(incidence,size-incidence)~period+(1|herd),data=cbpp,family=binomial)
rsq.glmm(glmm1)
rsq(glmm1)

Run the code above in your browser using DataLab