I have a dataset with count data as response variable ranging from 0-5 (number of chicks fledged). I intend to carry out a GLMM and need to know which distribution my data follows. I used the descdist() function because I've seen people recommend it a few times, but I'm not quite sure how to interpret it other than that my data do not follow either the normal, poisson or negative binomial distributions. However, I don't know what other options there are for count data.

The data are not overdispersed (mean = 2.062, var = 2.005; dispersion test = p > 0.05), so in that sense poisson would be the right choice (I think?). However I've tried to fit the poisson and the negative binomial distribution and neither fit (not by a long shot), which I guess was to be expected when looking at the Cullen and Frey graph. I believe the data are zero-inflated (see barplot and script below), so I'm thinking of using a zero-inflated poisson, but how can I be sure that this will suffice? Is there a way of checking whether a zero-inflated model is correct? Also, if the zero-inflated poisson isn't the way to go, what other options do I have? Is there a way to transform the data (I'd rather not) so one of the aforementioned distributions will fit better?

I'm not great at stats and relatively new to R, so all help is appreciated, but simple language/script will help me best. I've added a screenshot of the dataset below.

enter image description here enter image description here enter image description here

I made a frequency table (ChicksFledgedCount) for the number of chicks fledged in order to carry out a goodness of fit test (I did it this way because I used an example from the internet that had done this).

#Fit poisson and negative binomial distributions
#Fit Chicks Fledged to poisson distribution -> p< 0.001
CF.fitpois <- goodfit(ChicksFledgedCount, type="poisson")

 Goodness-of-fit test for poisson distribution

                     X^2 df     P(> X^2)
Likelihood Ratio 395.253  4 2.950794e-84

#Check for negative binomial -> p< 0.001
CF.fitnbinom <- goodfit(ChicksFledgedCount, type="nbinomial")

     Goodness-of-fit test for nbinomial distribution

                      X^2 df     P(> X^2)
Likelihood Ratio 395.7278  3 1.864406e-85

I also checked whether the data were zero-inflated using a script I copied from someone else (so I'm not 100% sure it's correct).

#Check whether data is zero-inflated
pois_data <- HavikData$Chicks_fledged
lambda_est <- mean(pois_data)

p0_tilde <- exp(-lambda_est)
n0 <- sum(1*(!(pois_data >0)))
n <- length(pois_data)

#Number of observations 'expected' to be zero; 86 -> actual number of zero's in dataset = 174
[1] 85.97555

#The JVDB score test 
numerator <- (n0 -n*p0_tilde)^2
denominator <- n*p0_tilde*(1-p0_tilde) - n*lambda_est*(p0_tilde^2)

test_stat <- numerator/denominator

#p<0.001, so data is zero-inflated
pvalue <- pchisq(test_stat,df=1, ncp=0, lower.tail=FALSE)
[1] 5.777855e-34
  • $\begingroup$ It looks like you have a zero-inflated Poisson. The main aspect is: what do the zeros mean for your model? Another way of doing this is by fitting different models (only intercept) (ZIP, ZINB, etc) and then compare them with likelihood ratio test, or cross-validation. $\endgroup$ – user289381 Jul 14 at 14:01

The other common alternative is a hurdle model; the comparison between the two is discussed in this post.

One visual method to check the fit is using a rootgram, which is explained in detail in this arxiv paper. The authors have created the countreg package that can be used to generate the plot. Unfortunately it is not on CRAN but you can install it using install.packages("countreg", repos="http://R-Forge.R-project.org")

| cite | improve this answer | |

You could try the DHARMa package to assess if a model fitted with poisson or negative binomial is a good choice for you data, and whether zero-inflation is an issue. The accompanying vignette is very comprehensive and guides you through the steps you can take to ensure that your model specifications are appropriate.

| cite | improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.