3

In a previous question (No zeros predicted from zeroinfl object in R?) there was a great answer explaining why the predicted count distribution from a pscl package ZINB model using the function zeroinfl included so few zeros, and how one would use the different type arguments of the predict.zeroinfl function to generate a predicted count distribution that better reflected the data.

I am running into the same problem, except I am using glmmTMB instead of zeroinfl for a variety of reasons related to model flexibility. The solution to the previous question involved using the argument type = "prob" to estimate the probability of getting a specific value over a range of observed counts. There is no analogous type argument for the predict.glmmTMB function (https://www.rdocumentation.org/packages/glmmTMB/versions/0.2.2.0/topics/predict.glmmTMB). See below for a reproducible example of the problem using glmmTMB. I understand why predictions based on expected value produce so few zeros, but how could I generate a predicted count distribution that more accurately reflects the observed distribution with a model of class glmmTMB?

library(glmmTMB)
data("bioChemists", package = "pscl")
zinb <- glmmTMB(art ~ fem + mar + kid5 + phd + ment, ziformula = ~ ., data = 
bioChemists, family = nbinom2(link = "log"))

table(round(predict(zinb, type="response"))) 
table(bioChemists$art)

Thank you in advance.

Andrew Bade
  • 333
  • 3
  • 10

0 Answers0