0

I have species richness data and serval environmental data. My study design is nested i.e, 30 sites, with each site has 2 - 8 plots, and each plot has 20 quadrat. I used the species richness from each quadrat as Y.

Then I fitted a Generalized linear mixed models (see below the code). But when I plot the result, the figure looks weird (see attached), I wonder what could trigger this? The random effect?

        r = glmer(species richness ~ scale(X1) + scale(X2) + 
               scale(X3) + scale(X4) 
               + (1|site/plot), data = data, family = 
               poisson(link = "log"))
    
       plot(r)

Figure

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
  • 2
    Since SO should be used primarily for code it would help to have the data and actual code that you used so that others can replicate the problem. @user2974951 points you to a great resource for the statistical problems. To diagnose the problems, I would include only the random effects to start, then add variables X1-X4 one at a time to see where a problem might exist. You might have a linear combination of variables that (near) perfectly predict the outcome. –  Nov 15 '21 at 14:00

1 Answers1

2

Even if this "looks weird," it's exactly what you should expect when modeling small numbers of counts.

Quantization is to be expected when you are modeling count data. Your observations can only take on non-negative integer values. Thus it's not surprising that the standardized Pearson residuals between those values and their fitted/predicted values, (observed-fitted)/sqrt(fitted), as plotted here, would also be quantized as seen in the multiple near-parallel sets of residual values.

That's particularly visible here as your fitted values are themselves very small. If your fitted value is 1, then the standardized residual is simply the residual itself (square root of fitted value is 1), and observed values can only be 0, 1, 2, 3, ... Thus your standardized residuals about that fitted value can only be -1, 0, 1, 2, ... respectively. That's just what you have. As the fitted values increase the value of sqrt(fitted) also increases, so the quantized scaled residual values come closer together at higher fitted values. That's also clear in your plot.

For further investigation, the DHARMa package provides a rich set of tools for evaluating residuals in this type of model.

EdM
  • 57,766
  • 7
  • 66
  • 187