I want to run a zero-inflated negative binomial regression in R, but one of my variables exhibits quasi-complete separation and throws errors for both the negative binomial and logistic pieces. I've been using the zeroinfl() function in the pscl package:

pop_dense_zinb <- 
   zeroinfl(thing_count ~ 
         data = dataset, 
         dist = "negbin", 
         EM = TRUE)


Warning: glm.fit: fitted rates numerically 0 occurred
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Error in glm.fitter(x = X, y = Y, w = w, start = start, etastart = etastart,  : 
  NA/NaN/Inf in 'x'

What can I do (in general, and particularly in R)? Is there an R package that can handle penalized likelihood methods like Firth in a zero-inflated negative binomial regression? I don't want to toss this variable because it's the best predictor of the outcome, which makes a lot of sense empirically, as well.

  • $\begingroup$ Please edit to clarify if you are asking about how this is addressed in general, or if you're just asking for r code / packages. The latter is off topic here, but the former would be a good question for our site. $\endgroup$ Apr 29, 2019 at 15:14
  • $\begingroup$ I'm interested in both what statistical method is most appropriate and how to program said method in R. Edited! $\endgroup$ May 1, 2019 at 2:48

1 Answer 1


I wouldn't know of a bias-adjusted zero-inflated model (a la Firth & Kosmidis). However, it's fairly easy to combine a bias-adjusted binary regression model with a hurdle regression.

The standard hurdle(y ~ ...) model can also be estimated by separately calling glm(factor(y > 0) ~ ..., family = binomial) and zerotrunc(y ~ ..., subset = y > 0) (using the countreg package from R-Forge).

Instead of estimating the binary zero hurdle part (y = 0 vs. greater) with glm(..., family = binomial) you can use brglm2 or logistf etc. The zero-truncated count part is not affected by this and can either be taken from hurdle() as before or equivalently from zerotrunc().


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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