if (FALSE) { # require("lme4") && require("see")
# lme4 model
data(mtcars)
model <- lme4::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)
# Compute BLUPs
estimate_grouplevel(model, type = "total")
}
Run the code above in your browser using DataLab