# NOT RUN {
if (require("lme4") && require("see")) {
# Random intercept ------------
model <- lmer(mpg ~ hp + (1 | carb), data = mtcars)
random <- estimate_grouplevel(model)
random
# Visualize random effects
plot(random)
# Show group-specific effects
estimate_grouplevel(model, deviation = FALSE)
# Reshape to wide data so that it matches the original dataframe...
reshaped <- reshape_grouplevel(random, indices = c("Coefficient", "SE"))
# ... and can be easily combined
alldata <- cbind(mtcars, reshaped)
# Use summary() to remove duplicated rows
summary(reshaped)
}
# }
Run the code above in your browser using DataLab