rsq.lmm: R-Squared for Linear Mixed Models

View source: R/rsq.R

rsq.lmmR Documentation

R-Squared for Linear Mixed Models

Description

Calculate the R-squared for linear mixed models.

Usage

rsq.lmm(fitObj,adj=FALSE)

Arguments

fitObj

an object of class "merMod" or "lmerMod" or "lme", usually, a result of a call to lmer in lme4, or lme in nlme.

adj

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

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

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.

Author(s)

Dabao Zhang, Department of Statistics, Purdue University

References

Zhang, D. (2020). Coefficients of determination for mixed-effects models. arXiv:2007.0867.

See Also

rsq, rsq.v.

Examples

# lmer in lme4
require(lme4)
lmm1 <- lmer(Reaction~Days+(Days|Subject),data=sleepstudy)
rsq(lmm1)
rsq.lmm(lmm1)

# lme in nlme
require(nlme)
lmm2 <- lme(Reaction~Days,data=sleepstudy,random=~Days|Subject)
rsq(lmm2)
rsq.lmm(lmm2)

rsq documentation built on Oct. 22, 2023, 5:07 p.m.

Related to rsq.lmm in rsq...