I am trying to simulate from observed data that I have fit to a zero-inflated Poisson regression model. I fit the data in R using zeroinfl() from the package pscl, but I am having trouble figuring out how to derive the ZIP distribution from the coefficient estimates.

I know how to derive the predicted counts from these coefficient estimates (more information here: http://www.ats.ucla.edu/stat/stata/faq/predict_zip.htm), but can anyone help me understand how to find/derive estimates for my distribution parameters (i.e. lambda for the Poisson distribution, p for the Bernoulli distribution) that I can then sample from?


1 Answer 1


You can get the probability of zero-inflation by

p <- predict(object, ..., type = "zero")

and the mean of the count distribution by

lambda <- predict(object, ..., type = "count")

See Appendix C of vignette("countreg", package = "pscl") for a few more details.

To simulate the distribution, you can either do it manually with

ifelse(rbinom(n, size = 1, prob = p) > 0, 0, rpois(n, lambda = lambda))

or you can use rzipois() from the VGAM package

rzipois(n, lambda = lambda, pstr0 = p)

which essentially also does an ifelse() as above but adds a few sanity checks etc.


Your Answer

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

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