There is no update
method for the "zeroinfl"
class but we can define one:
library(Formula)
update.zeroinfl <- function(object, new, ...) {
call <- object$call
call$formula <- update(as.Formula(formula(object)), new)
eval.parent(call)
}
Now we test it out:
> update(model.zip, . ~ . - X2 | . - X2)
Call:
zeroinfl(formula = Y ~ X1 | X1, data = data.df, dist = "poisson")
Count model coefficients (poisson with log link):
(Intercept) X1
-4.0538 0.6139
Zero-inflation model coefficients (binomial with logit link):
(Intercept) X1
-6.50595 -0.06057