Extract random-effects variances, standard deviation, and correlations from an LMM
lmm_re_varcor.RdCalculates the random-effects variances, standard deviation, and correlations
from an lme4::lmer or nlme::lme object and returns a data.frame of results.
Arguments
- x
An
lme4::lmerornlme::lmemodel object.
Examples
#----------------------------------------------------------------------------
# lmm_re_varcor() examples
#----------------------------------------------------------------------------
library(bkstat)
data(Orthodont, package="nlme")
mod_lmer <- lme4::lmer(distance ~ age + (age|Subject), data = Orthodont)
mod_lme <- nlme::lme(fixed = distance ~ age, random = ~age|Subject, data = Orthodont)
lmm_re_varcor(mod_lmer)
#> Source Variance SD
#> 1 Subject:(Intercept) 5.4166005 2.3273591
#> 2 Subject:age 0.0512792 0.2264491
#> 3 Residual 1.7161573 1.3100219
lmm_re_varcor(mod_lme)
#> Source Variance SD Correlation
#> 1 (Intercept) 5.41508754 2.3270341 (Intr)
#> 2 age 0.05126955 0.2264278 -0.609
#> 3 Residual 1.71620400 1.3100397