hurdle(formula, data, subset, na.action, weights, offset,
dist = c("poisson", "negbin", "geometric"),
zero.dist = c("binomial", "poisson", "negbin", "geometric"),
link = c("logit", "probit", "cloglog", "cauchit", "log"),
control = hurdle.control(...),
model = TRUE, y = TRUE, x = FALSE, ...)model.frame.zero.dist = "binomial".hurdle.control.TRUE the corresponding components
of the fit (model frame, response, model matrix) are returned.hurdle.control in the
default setup."hurdle", i.e., a list with components including"count" and "zero"
containing the coefficients from the respective models,optim call(s) for
minimizing the negative log-likelihood(s),optim call,optim call(s),"count" and "zero"
containing the offset vectors (if any) from the respective models,n - 2),"count", "zero" and
"full" containing the terms objects for the respective models,optim output(s)),"count" and "zero" with character
strings describing the respective distributions used,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 zero hurdle component, e.g.,
y ~ x1 + x2 | z1 + z2 + z3 giving the count data model y ~ x1 + x2
conditional on (|) the zero hurdle model y ~ z1 + z2 + z3.
Offsets can be specified in both parts of the model pertaining to count and
zero hurdle model: y ~ x1 + offset(x2) | z1 + z2 + offset(z3), where
x2 is used as an offset (i.e., with coefficient fixed to 1) in the
count part and z3 analogously in the zero hurdle part. By the rule
stated above y ~ x1 + offset(x2) is expanded to
y ~ x1 + offset(x2) | x1 + offset(x2). Instead of using the
offset() wrapper within the formula, the offset argument
can also be employed which sets an offset only for the count model. Thus,
formula = y ~ x1 and offset = x2 is equivalent to
formula = y ~ x1 + offset(x2) | x1.
All parameters are estimated by maximum likelihood using optim,
with control options set in hurdle.control.
Starting values can be supplied, otherwise they are estimated by glm.fit
(the default). By default, the two components of the model are estimated separately
using two optim calls. Standard errors are derived numerically using
the Hessian matrix returned by optim. See
hurdle.control for details.
The returned fitted model object is of class "hurdle" 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 components,
respectively. For details see below.
A set of standard extractor functions for fitted model objects is available for
objects of class "hurdle", including methods to the generic functions
print, summary, coef,
vcov, logLik, residuals,
predict, fitted, terms,
model.matrix. See predict.hurdle for more details
on all methods.Cameron, A. Colin and Pravin K. Trivedi 2005. Microeconometrics: Methods and Applications. Cambridge: Cambridge University Press.
Mullahy, J. 1986. Specification and Testing of Some Modified Count Data Models. Journal of Econometrics. 33:341--365.
Zeileis, Achim, Christian Kleiber and Simon Jackman 2008.
hurdle.control, glm,
glm.fit, glm.nb,
zeroinfl## data
data("bioChemists", package = "pscl")
## logit-poisson
## "art ~ ." is the same as "art ~ . | .", i.e.
## "art ~ fem + mar + kid5 + phd + ment | fem + mar + kid5 + phd + ment"
fm_hp1 <- hurdle(art ~ ., data = bioChemists)
summary(fm_hp1)
## geometric-poisson
fm_hp2 <- hurdle(art ~ ., data = bioChemists, zero = "geometric")
summary(fm_hp2)
## logit and geometric model are equivalent
coef(fm_hp1, model = "zero") - coef(fm_hp2, model = "zero")
## logit-negbin
fm_hnb1 <- hurdle(art ~ ., data = bioChemists, dist = "negbin")
summary(fm_hnb1)
## negbin-negbin
## (poorly conditioned zero hurdle, note the standard errors)
fm_hnb2 <- hurdle(art ~ ., data = bioChemists, dist = "negbin", zero = "negbin")
summary(fm_hnb2)Run the code above in your browser using DataLab