`check_zeroinflation()`

checks whether count models are over- or
underfitting zeros in the outcome.

check_zeroinflation(x, tolerance = 0.05)

x | Fitted model of class |
---|---|

tolerance | The tolerance for the ratio of observed and predicted
zeros to considered as over- or underfitting zeros. A ratio
between 1 +/- |

A list with information about the amount of predicted and observed zeros in the outcome, as well as the ratio between these two values.

If the amount of observed zeros is larger than the amount of predicted zeros, the model is underfitting zeros, which indicates a zero-inflation in the data. In such cases, it is recommended to use negative binomial or zero-inflated models.

if (require("glmmTMB")) { data(Salamanders) m <- glm(count ~ spp + mined, family = poisson, data = Salamanders) check_zeroinflation(m) }#> # Check for zero-inflation #> #> Observed zeros: 387 #> Predicted zeros: 298 #> Ratio: 0.77 #>#>