# NOT RUN {
data(sleepstudy, package = 'lme4')
fm <- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
#Observation level deletion and diagnostics
obs.infl <- hlm_influence(fm, level = 1)
dotplot_diag(x = obs.infl$cooksd, cutoff = "internal", name = "cooks.distance", modify = FALSE)
dotplot_diag(x = obs.infl$mdffits, cutoff = "internal", name = "cooks.distance", modify = FALSE)
# Subject level deletion and diagnostics
subject.infl <- hlm_influence(fm, level = "Subject")
dotplot_diag(x = subject.infl$cooksd, cutoff = "internal",
name = "cooks.distance", modify = FALSE)
dotplot_diag(x = subject.infl$mdffits, cutoff = "internal", name = "mdffits", modify = "dotplot")
# }
Run the code above in your browser using DataLab