x <- rpois(100, 2)
zip.mle(x)
sum( dpois(x, mean(x), log = TRUE) ) ## poisson log-likelihood
## small difference in the two log-likelihoods as expected.
x <- rpois(1000, 10)
x[ sample(1:1000, 100) ] <- 0
zip.mle(x)
sum( dpois(x, mean(x), log = TRUE) ) ## poisson log-likelihood
## significant difference in the two log-likelihoods.
Run the code above in your browser using DataLab