# which model with count data and 3 factors, problem with glm

This is for a study for the abundance of counted individuals of the taxon Nematocera (gnats) in dependence of the three factors "Betrieb"(two levels), "Standort" (8 levels) and "Variante" (3 levels). I have 6 replicates for each markedness. First I tried it with glm poisson.

-> glm(log(Nematocera+1) ~ Betrieb+Standort+Variante, poisson)


but there are 50+ warnings in R:

In dpois(y, mu, log = TRUE) : non-integer x = 5.613128

what does that mean? I do have count data, does the transformation change this in some way? And what can I do against this? My output isn't good anyway:

Deviance Residuals:
Min        1Q    Median        3Q       Max
-0.63233  -0.21529  -0.01273   0.20194   0.75027

Coefficients: (1 not defined because of singularities)

Estimate Std. Error z value Pr(>|z|)
(Intercept)  1.9187905  0.1014629  18.911   <2e-16 ***
Betrieb2    -0.1125782  0.1318159  -0.854    0.393
Standort2    0.0003384  0.1280454   0.003    0.998
Standort3    0.0333526  0.1270018   0.263    0.793
Standort4   -0.0434195  0.1294691  -0.335    0.737
Standort5    0.0941010  0.1323946   0.711    0.477
Standort6    0.0973171  0.1322933   0.736    0.462
Standort7    0.0182000  0.1348590   0.135    0.893
Standort8           NA         NA      NA       NA
Variante2    0.0618031  0.0781974   0.790    0.429
Variante3   -0.0834252  0.0811046  -1.029    0.304


Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 18.177  on 143  degrees of freedom
Residual deviance: 12.840  on 134  degrees of freedom
AIC: Inf

Number of Fisher Scoring iterations: 4


Means singularities, that there are not enough replicates for the three factors? And one level was completely ignored by R... and I'm shure, there are significances. But the model-critiqeu looks good.

After this i tried a linear model, where the warnings do not occur anymore, but the output is nearly the same. Besides the lm should not be used for count data. Am I right?

At least I tried the glm for the several factors:

glm(log(Nematocera+1) ~Betrieb, family = poisson)


with the same warnings, but no singularities.

I really don't know which model to use. I'm sorry for the novice approach, but I never really understood statistics. It would be very nice, if someone could help me, please.

• In addition to the answer: You should use a Generalized Linear Mixed Model here. You don't explain what your factors mean, but (taking into account that "Standort" means "site") it looks like at least Standort should be modeled as a random effect. Your model is likely to be over-parameterized if you include Standort as a fixed effect. Mar 7, 2016 at 9:21
• Ok, i never used the Generalized Linear Mixed Model before. And yes, "Standort" means site, "Betrieb" could be described with region and "Variante" with land use. Thank you, i'll try the GLMM! Mar 8, 2016 at 15:57
• Maybe you can tell me how this would look like in R? I will have to get the lme4 - package. And then 'glmer(Nematocera ~ Betrieb + Variante + (1|Standort), family = "poisson")'. I found no good example on this... Mar 20, 2016 at 16:02

glm(Nematocera ~ Betrieb+Standort+Variante, poisson)