Simulate from a zero-inflated poisson distribution

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? Thanks!

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

library("VGAM")
rzipois(n, lambda = lambda, pstr0 = p)

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