# What is the hat matrix and why is it inappropriate for GLMM standardized residuals?

When I run this code to plot standardized residuals for a standard logistic regression:

#### Standarized Residuals Fixed Model ####
model.data <- augment(normal.model) %>%
mutate(index = 1:n())

model.data %>% top_n(3,.cooksd)

ggplot(model.data,
aes(index,
.std.resid)) +
geom_point(aes(color = factor(Outcome)),
alpha = .5)


There is no issue and I can plot what I want. However, when I do the same thing for a random intercepts mixed model:

model.data.ri <- augment(random.model) %>%
mutate(index = 1:n())


I get this warning:

Warning messages:
1: In hatvalues.merMod(model) :
the hat matrix may not make sense for GLMMs
2: In hatvalues.merMod(model) :
the hat matrix may not make sense for GLMMs


Now of course I could just run this as is, but I was curious what the hat matrix was and why one would need to be careful with a GLMM interpretation of it?

• stats.stackexchange.com/…
– whuber
Sep 18 at 10:58
• I'm afraid none of those discuss their application to GLMMs though. I think I found a paper that at least tries to discuss this topic. Sep 27 at 4:19