I am setting up models of the diversity data (Shannon Index) of bees and hoverflies to find out which in which studied seed mixture (site) the diversity was higher. In addition, I would like to know if this was influenced by the diversity of the plant species or by the flower cover of these. I added the site and the field visits (3 times) as a random effect, because they were chosen randomly and I do not expect a direct effect on the diversity, or this is not of interest.

Since I am not very familiar with model validation and there is no clear explanation online how to interpret the results of a test for overdispersion or zero inflation, I would like to pray for help.

What I have done so far:

my models basically look like this:

lmer(H_bee ~ seedmixture + H_plant + blueh_deck + (1|location) + (1|fieldvisit), data = insect_plant, REML = FALSE).

Some Information: There are two seed mixtures (RH and WD), I have visited 4 locations and those ones in 3 different month (fieldvisit).

Results of the Model


Linear mixed model fit by maximum likelihood  ['lmerMod']
Formula: H_bee ~ seedmixture + H_plant + blueh_deck + (1 | location) +      (1 | fieldvisit)
   Data: insect_plant

    AIC      BIC   logLik deviance df.resid 
   -87.2    -64.3     50.6   -101.2      189 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.3061 -0.4246 -0.1407  0.0503  5.9872 

Random effects:
 Groups     Name        Variance Std.Dev.
 location   (Intercept) 0.002702 0.05198 
 fieldvisit (Intercept) 0.002588 0.05087 
 Residual               0.033112 0.18197 
Number of obs: 196, groups:  location, 4; fieldvisit, 3

Fixed effects:
             Estimate Std. Error t value
(Intercept)  0.073241   0.060921   1.202
seedmixtureWD   -0.043332   0.031068  -1.395
H_plant      0.034441   0.033140   1.039
blueh_deck  -0.005288   0.005611  -0.943

Correlation of Fixed Effects:
           (Intr) StgtWD H_plnt
SaatgutWD  -0.544              
H_plant    -0.582  0.341       
blueh_deck -0.398  0.433  0.012

I used the DHARMa Package to test for zero-inflation and also overdispersion. The overdispersion Graph looks quite good to me, but the zero-inflation is a bit confusing...

I also used the plot() function with the simulationOutput. Thats the point where I thought that the models are not well. First of all there is the note "Quantile deviations detected" and further more the QQ plot has that big step at the end to another bunch of Datapoints in the plot. Also the red line is not fitting the black points, as I know it from other models.

QQ Plot

enter image description here

Overdispersion test

enter image description here

Zero inflation test

enter image description here

I would be so thankful to get some advice, whether this model is reliable, or how I could get the problem under control. If it were a Poisson distribution, I would switch to a negative binomial distribution. However, I have not found a solution for this in the lmer models.

  • $\begingroup$ Could you please add the results of summary(model) to your question, as text (e.g. in a code block), and delete the image of the fixed-effect table? Images are bad because they're unsearchable and inaccessible to people using screen readers ... $\endgroup$
    – Ben Bolker
    Sep 23, 2021 at 23:35
  • $\begingroup$ Thank you for the fast feedback. I am new here and did not know how to add code properly in the question, but have added the summary of the model now. $\endgroup$ Sep 24, 2021 at 7:46

1 Answer 1

  • Zero-inflation and overdispersion are not really relevant to linear mixed models.
  • It looks like you have a small subset of your data that are outliers in diversity; most of your residuals form a single mode, but there are a few (about a dozen, by eye) that have much larger values. Some, but not all, of these outliers are also associated with large predicted values.

You should try to figure out which observations these are and what's going on with them. If you plot(fitted_model, id = 0.05) you'll get a residuals-vs-fitted plot with some outliers (see ?lme4::plot.merMod for details) identified by row number.

For what it's worth, it may not work very well to treat site and field as random effects if they each only have three levels. (It would help to have summary(fitted_model) included in the text of your question [as cut-and-pasted text, not as a screenshot image].)

  • $\begingroup$ I was also unsure about adding the field visits as a random effect in the model. However, I would argue that the time at which you go into the field has no effect on diversity. However, since the diversity of bees changes throughout the year, the time at which one takes the data does suggest different diversities. Therefore, I think it is necessary to include the field visits in the model. Since the time at which the data is recorded does not affect diversity, I have included field visits as a random effect in the model. $\endgroup$ Sep 24, 2021 at 7:55
  • $\begingroup$ You may be a little bit confused about the difference between nuisance variables and random effects. Nevertheless, based on the summary your model looks OK with the exception of the outliers, so I wouldn't worry about it too much. $\endgroup$
    – Ben Bolker
    Sep 24, 2021 at 14:09
  • $\begingroup$ thank you so much for the assessment! That is very good to hear. $\endgroup$ Sep 25, 2021 at 11:24
  • $\begingroup$ Nevertheless, I would worry about the outliers - not so much because I think they will invalidate the model as that you should understand what's going on in your data. You should be able to use the influence() function from the car package to understand what effect these observations are having on your conclusions (or, more crudely, refit the model with those observations excluded and see what happens) $\endgroup$
    – Ben Bolker
    Sep 25, 2021 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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