zeroinfl(formula, data, subset, na.action, weights, offset,
dist = c("poisson", "negbin", "geometric"),
link = c("logit", "probit", "cloglog", "cauchit", "log"),
control = zeroinfl.control(...),
model = TRUE, y = TRUE, x = FALSE, ...)model.frame.zeroinfl.control.TRUE the corresponding components
of the fit (model frame, response, model matrix) are returned.zeroinfl.control in the
default setup."zeroinfl", i.e., a list with components including"count" and "zero"
containing the coefficients from the respective models,optim call for
minimizing the negative log-likelihood,optim call,optim call,n - 2),"count", "zero" and
"full" containing the terms objects for the respective models,optim output),link,optim,"count" and "zero"
containing the contrasts corresponding to levels from the
respective models,model = TRUE),y = TRUE),"count" and "zero"
containing the model matrices from the respective models
(if x = TRUE),formula can be used to specify both components of the model:
If a formula of type y ~ x1 + x2 is supplied, then the same
regressors are employed in both components. This is equivalent to
y ~ x1 + x2 | x1 + x2. Of course, a different set of regressors
could be specified for the count and zero-inflation component, e.g.,
y ~ x1 + x2 | z1 + z2 + z3 giving the count data model y ~ x1 + x2
conditional on (|) the zero-inflation model y ~ z1 + z2 + z3.
A simple inflation model where all zero counts have the same
probability of belonging to the zero component can by specified by the formula
y ~ x1 + x2 | 1.
All parameters are estimated by maximum likelihood using optim,
with control options set in zeroinfl.control.
Starting values can be supplied, estimated by the EM (expectation maximization)
algorithm, or by glm.fit (the default). Standard errors
are derived numerically using the Hessian matrix returned by optim.
See zeroinfl.control for details.
The returned fitted model object is of class "zeroinfl" and is similar
to fitted "glm" objects. For elements such as "coefficients" or
"terms" a list is returned with elements for the zero and count component,
respectively. For details see below.
A set of standard extractor functions for fitted model objects is available for
objects of class "zeroinfl", including methods to the generic functions
print, summary, coef,
vcov, logLik, residuals,
predict, fitted, terms,
model.matrix. See predict.zeroinfl for more details
on all methods.Cameron, A. Colin and Pravin K. Trivedi. 2005. Microeconometrics: Methods and Applications. Cambridge: Cambridge University Press.
Lambert, Diane. 1992.
Zeileis, Achim, Christian Kleiber and Simon Jackman 2007.
zeroinfl.control, glm,
glm.fit, glm.nb,
hurdle## data
data("bioChemists", package = "pscl")
## without inflation
## ("art ~ ." is "art ~ fem + mar + kid5 + phd + ment")
fm_pois <- glm(art ~ ., data = bioChemists, family = poisson)
fm_qpois <- glm(art ~ ., data = bioChemists, family = quasipoisson)
fm_nb <- glm.nb(art ~ ., data = bioChemists)
## with simple inflation (no regressors for zero component)
fm_zip <- zeroinfl(art ~ . | 1, data = bioChemists)
fm_zinb <- zeroinfl(art ~ . | 1, data = bioChemists, dist = "negbin")
## inflation with regressors
## ("art ~ . | ." is "art ~ fem + mar + kid5 + phd + ment | fem + mar + kid5 + phd + ment")
fm_zip2 <- zeroinfl(art ~ . | ., data = bioChemists)
fm_zinb2 <- zeroinfl(art ~ . | ., data = bioChemists, dist = "negbin")Run the code above in your browser using DataLab