I have count data with lots of zero. I have done a GLM with poisson distribution, and I think that using the zero inflated model might improve the fit. Now my problem, I have been working with SPSS. This does not have the zero inflated model build in, and using the R extension did not work. So I have moved to R completely. But I have problem building the model.
I found the pscl package, which can perform zero-inflated Poisson regression. What I want to test are main effects for variable 1 and variable2 and an interaction between them. Plot is a fixed factor.
First I ran a normal poisson distributed model
mod1 = glm(count ~Plot + var1+var2 + var1*var2, family= poisson)
This worked fine. Now for the zeroinfl.
I checked the ?zeroinfl and I saw some things which confuse me. Namely the use of | and |1.
var1 and var2 have 2 levels, and in my data therefore have a value 1 or 2 as seen below. This is just an example and there are more plots. But every combination of var1 and var2 has the same probability of having count zero.
plot Var1 Var2 count 1 1 1 0 1 1 2 1 1 2 1 2 1 1 2 0
Now I tried it like this.
zeroinfl(n ~ Plot + var1+var2 + var1*var2|1, data = dat)
But I don't think it is correct. I only get an intercept in the zero distributed output, and not the main effects and interaction. Also the zeroinfl does a normal poisson glm and the values differ from my spss output.
So, can anyone help/give me some tips on how to build the model correctly?
Thank you very much.