Dear UseRs: I have simulated data from a zero-inflated Poisson model, and would like to use a package like zicounts to test my code of fitting the model. My question is: can I use zicounts directly with the following simulated data?
Create a sample of n=1000 observations from a ZIP model with no intercept and a single covariate x_{i} which is N(0,1). The logit part is logit(p_{i})=x_{i}*beta with beta=1, and the Poisson part is log(ยต_{i})=x_{i}*gamma with gamma=1. beta.true<-1.0 gamma.true<-1.0 n<-1000 x<-matrix(rnorm(n),n,1) pi<-expit(x*beta.true) mu<-exp(x*gamma.true) y<-numeric(n) # blank vector z<-(runif(n)<pi) # logical: T with prob p_i, F otherwise y[z]<-rpois(sum(z),mu[z]) # draw y_i ~ Poisson(mu_i) where z_i = T y[!z]<-0 # set y_i = 0 where z_i = F Thanks for your time! Jacob Jacob L van Wyk Department of Statistics University of Johannesburg, APK P O Box 524 Auckland Park 2006 South Africa Tel: +27 11 489 3080 Fax: +27 11 489 2832 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.