# Handling quasi-perfect separation in a zero-inflated negative binomial regression in R

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 ~
dataset[["variable_causing_issues"]],
data = dataset,
dist = "negbin",
EM = TRUE)



Errors:

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.

• 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. – gung - Reinstate Monica Apr 29 '19 at 15:14
• I'm interested in both what statistical method is most appropriate and how to program said method in R. Edited! – rilkehayden May 1 '19 at 2:48

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().