if (FALSE) { # require("glmmTMB") && require("DHARMa")
data(Salamanders, package = "glmmTMB")
m <- glm(count ~ spp + mined, family = poisson, data = Salamanders)
check_zeroinflation(m)
# for models with zero-inflation component, it's better to carry out
# the check for zero-inflation using simulated residuals
m <- glmmTMB::glmmTMB(
count ~ spp + mined,
ziformula = ~ mined + spp,
family = poisson,
data = Salamanders
)
res <- simulate_residuals(m)
check_zeroinflation(res)
}
Run the code above in your browser using DataLab