# NOT RUN {
library(lme4)
fit1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
# all random effect variance components
re_var(fit1)
re_var(fit1, adjusted = TRUE)
# just the rand. slope-intercept covariance
get_re_var(fit1, "tau.01")
sleepstudy$mygrp <- sample(1:45, size = 180, replace = TRUE)
fit2 <- lmer(Reaction ~ Days + (1 | mygrp) + (Days | Subject), sleepstudy)
re_var(fit2)
# }
Run the code above in your browser using DataLab