3
$\begingroup$

I have a large dataset with the count data and I computed the following full model (covariates are all scaled) :

    myModel <- glmmTMB(Nbr_ind ~ Weather_covariates + Landuse_covariates + other_covariates 
+ interactions + (1|site / survey_ID ), na.action="na.fail", data=myTable, family="nbinom2")

As a matter of fact, my dataset is made of sites that are monitored from one full night up to several nights in a raw, several times.

However, when I draw residuals VS fitted values, I obtain this graph : enter image description here

Thus, even if I'm using a negative binomial distribution, it seems that I still have a strong pattern.

I tried to fix it by correcting what seems to be a little zero inflation using ziformula = ~1 or ziformula= ~some_of_my_covariates (p-value = 0.04 with testZeroInflation(myModel)) but it doesn't correct this pattern (the graph is almost the same).

I also tried to correct it using dispformula = some_of_my_covariates (covariates were chosen because they showed an obvious pattern when drawing them VS fitted residuals). But it didn't work either.

I was thus wondering :

  1. If I was right and if even when using negative binomial distributions, residuals VS fitted shoudn't have any pattern.
  2. If it might be due to overdispersion?
  3. What are the possible options to correct it?

Thank you!

Here an edit following Robert Long answer. The graphs that I get when I use the DHARMa package :

enter image description here

$\endgroup$
1
  • $\begingroup$ If one (or both) of the answers solve your problem, you are encouraged to click the check-mark to accept one of them. $\endgroup$
    – Ben Bolker
    Jun 2, 2021 at 14:11

2 Answers 2

3
$\begingroup$

It looks like the plot you have included is just the raw residuals vs the fitted values. Since you are dealing with a negative binomial distrubution, there is no reason to expect this type of plot to be similar to linear regression where we often want to see no pattern. For one thing, in a glm(m) we use a link function and target distribution so that the variance of the response can depend on it's mean - so just from this point of view I don't think this residual plot is useful. You could take a look at the DHARMa package for more relevant plots.

$\endgroup$
3
  • $\begingroup$ Thank you very much for this quick answer! I saw in Zuur's book, a plot of residuals VS fitted values for a model with a negative binomial distribution (computed with glm.nb) and I thus thought it was necessary, but I must have misinterpreted it! I already use DHARMa package to check the assumptions, but as I have a lot of data (1854), tests are easily significant and I have some difficulties to interpret them! $\endgroup$
    – Lea_M
    May 31, 2021 at 19:56
  • 1
    $\begingroup$ You're welcome. I'm not familiar with the book so I can't comment on that, but as far as checking assumptions is concerned, try not to worry about statistical significance. If you have a lot of data, a good way to think about model fit is to assess the model's predictive accuracy when you hold some of the data back for testing. I would recommend an approach based on knowledge of the subject area, rather than on statistical significance. $\endgroup$ May 31, 2021 at 20:06
  • $\begingroup$ Thank you for these advices! I'll test it! $\endgroup$
    – Lea_M
    May 31, 2021 at 20:11
3
$\begingroup$

By default, the residuals method for glmmTMB returns response residuals (i.e. raw (observed-expected, on the response scale), not Pearson residuals (which are scaled by their expected standard deviation, based on the model). Try

plot(fitted(myModel), residuals(myModel, type="pearson"))

That said, DHARMa is also great. Do read the vignettes — they have lots of other helpful information.

$\endgroup$
1
  • $\begingroup$ Thank you very much for this answer, I should have checked it! $\endgroup$
    – Lea_M
    Jun 2, 2021 at 12:07

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.