I have a count data set with lots of 0 Zero-inflated data set zero-inflated dataset

The dataset contains responds(which is the count data) and also three factors:temperature, food type, food concentration.

The data like:

foodtype quantity temperature count
Food3   Low     27  4
Food1   Medium  13  1
Food3   Medium  20  11
Food3   Medium  13  5
Food1   High    27  0
Food3   Medium  27  0
Food1   Low     20  0
Food1   Low     20  5
Food3   High    13  11
Food3   Medium  20  10
Food1   Medium  20  10
Food1   High    20  14
Food1   Medium  20  14
Food3   High    13  14
Food3   Low     20  3
Food1   High    27  6
Food3   High    27  9
Food2   Medium  20  21
Food2   High    20  24
Food1   Low     13  0
Food3   Low     13  0
Food3   High    20  19

I'm doing the Zero-Inflated Models with codes:

mol<-zeroinfl(count~foodtype*quantity*temperature | count~foodtype*quantity*temperature,
dist="poisson", link="logit", data=mydata)

And the Erro shows:

Error in zeroinfl(count~foodtype*quantity*temperature | count~foodtype*quantity*temperature  : 
invalid dependent variable, non-integer values

Any ideas how to deal with the problem? Comments and solutions are high preciated! Thank you!

  • $\begingroup$ You seem to be using a LOGIT function for count data (and Poisson distribution). These two don't go together. Logit function is used for binomial data, while LOG function is typically used for the count data. $\endgroup$ – Tilen Mar 15 '17 at 22:31
  • 1
    $\begingroup$ @Tilen The link="logit" is fine (and actually is the default in zeroinfl) as it pertains to the binary inflation submodel. @X.Chi The problem is that you repeat count ~ ... after the | which is not valid. You should use count ~foodtype * quantity * temperature | foodtype * quantity * temperature. Or, even simpler, count ~foodtype * quantity * temperature because the terms in both submodels are the same. Finally, almost surely dist = "negbin" will lead to a much better fit because there seems to be overdispersion in the count response. $\endgroup$ – Achim Zeileis Mar 16 '17 at 0:19
  • $\begingroup$ @AchimZeileis you're right, I forgot about that. $\endgroup$ – Tilen Mar 16 '17 at 8:54
  • 1
    $\begingroup$ @AchimZeileis@Tilen, Dear AchimZeileis and Tilen, I really really appreciate your comments and answers. I run the model with dist="negbin", however, they gave a error: Error in solve.default(as.matrix(fit$hessian)) : system is computationally singular: reciprocal condition number = 2.39927e-17 In addition: Warning message: glm.fit: fitted probabilities numerically 0 or 1 occurred. Any ideas? $\endgroup$ – X.Chi Mar 16 '17 at 10:58
  • 1
    $\begingroup$ I would guess that there is not enough variation in the data to estimate the three-way interaction you have specified. Possibly there are some cell of food x quantity that have little or no variation in the count response. $\endgroup$ – Achim Zeileis Mar 16 '17 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.