I am trying to set up a zero-inflated poisson model in R and JAGS. I am new to JAGS and I need some guidance on how to do that.
I've been trying with the following where y[i] is the observed variable
model {
for (i in 1:I) {
y.null[i] <- 0
y.pois[i] ~ dpois(mu[i])
pro[i] <- ilogit(theta[i])
x[i] ~ dbern(pro[i])
y[i] <- step(2*x[i]-1)*y.pois[i] + (1-step(2*x[i]-1))*y.null[i]
log(mu[i]) <- bla + bla +bla + ....
theta[i] <- bla + bla + bla + ....
}
}
However this does not work as you cannot use <- on an observed variable.
Any ideas how to change/fix this? Is there an other way to set up the zero-inflated poisson model in JAGS?