I guess my comments have become so extensive that I should call them an answer.
If it's a situation where you want fixed effects, you can do it with a Poisson glm just as you can do ANOVA via lm. If you want a mixed model (glmm), you could use lme4
(such as the function glmer
), though there are other suitable packages (see below).
If you do want a fixed effects model, like an ANOVA but with Poisson data (and I am not saying that's what you should do, just that it sounds like what you're asking for), for factors you can literally just use exactly the same command in glm as in lm, but with an additional argument of family=poisson
.
Compare: summary(lm(count~spray,data=InsectSprays))
with summary(glm(count~spray,family=poisson,data=InsectSprays))
The anova
command can even be used to compare glms as it is used for lms. The if the null is true and the Poisson assumption holds, the deviance for the difference should be chi-square with the indicated d.f., but fully understanding even basic use of glms would require a textbook.
For packages that do glmms and their features, here