View source: R/cooks.distance_lmer.R
cooks.distance_lmer | R Documentation |
Function to compute Cook's distance for mixed models
cooks.distance_lmer(model, obs = FALSE)
model |
A mixed-effects model of class lmerMod (fitted with lme4). |
obs |
Logical, if TRUE, computes Cook's distance for individual observations as well. |
A named vector with Cook's distance values for each group of random effects and optionally for each observation.
# Example 1
library(lme4)
data("sleepstudy")
model <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)
cooks_distances <- cooks.distance_lmer(model)
# Example 2
data(mtcars)
model <- lmer(cyl ~ disp + (1 | hp) + (1 | gear), data = mtcars)
cooks_distances <- cooks.distance_lmer(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.