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)

           .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?

  • $\begingroup$ stats.stackexchange.com/… $\endgroup$
    – whuber
    Sep 18 at 10:58
  • $\begingroup$ 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. $\endgroup$ Sep 27 at 4:19

1 Answer 1


Thanks to whuber for pointing out some of the entries for hat martices on Cross Validated. I did find this particular discussion of what a hat matrix useful to a degree. However, there really wasn't a lot of mention from what I could tell about what differences lie in LM, LMM, and GLMM.

After some searching, I did come across this paper on the subject and its specific application to LMM and GLMM models. It is a very technical paper that I wish had a more parsimonious explanation of what is going on (seems to be the norm for stats papers to do little actual explanation of what their formulas mean for laymen). First, it appears even the authors have said this isn't a well discussed topic: enter image description here

The most relevant bit I found was this part, which explains that prior assumptions such as finding the identity of obtained from a MLE of predictor slopes:

enter image description here

Unfortunately this paper hasn't been cited by others so its difficult to understand whether or not their assumptions are held by different people. Additionally, it doesn't specify the practical discussion surrounding the topic: why this matters in terms of model diagnostics, inference from point estimates, etc. But at least this is somewhere to start in case anybody is interested.

If somebody has a explanation for why this actually matters, I would still be happy to hear it. This is the best answer I could find so far unfortunately.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.