GLM, Poisson - non-integer count numbers (average)

3

I'm doing GLM for frequency data of a x behavior. Since I have day 1 and day 2 observations, I averaged the frequencies of that two days, so my count data are not integers. However, I can not make the models when I use the Poisson distribution.

How do I resolve this?

I'm setting the template as follows:

al1<-glm(cbind(al)~sp*sexo,poisson(link="log"),data=abfm) 

But I get the following error message:

Warning messages: 
1: In dpois(y, mu, log = TRUE) : non-integer x = 4.500000 
2: In dpois(y, mu, log = TRUE) : non-integer x = 7.500000
    
asked by anonymous 21.08.2015 / 20:52

1 answer

2

You can not use the average of the two observations and at the same time use the Poisson distribution. You could try to figure out the probability distribution of the average of two random Poisson i.i.d variables, but I do not think that's the best way out.

For me, the best way out would be to use a repeated measures model, and to consider a random effect of individual for each day.

For this, considering that you have a database as follows:

> dados <- data.frame(
+   id = 1:100,
+   explicativa = runif(100, 0, 20)
+   )
> 
> dados$r1 <- rpois(100, dados$explicativa)
> dados$r2 <- rpois(100, dados$explicativa)
> 
> head(dados)
  id explicativa r1 r2
1  1    9.082513 16 14
2  2   17.741123 14 29
3  3   10.819865 13 12
4  4   18.527938 22 25
5  5    4.828392  6  7
6  6   13.986794 14 15 

r1 and r2 are the frequencies observed on day 1 and day 2.

Transform your data into tidy/long format:

library(tidyr);library(dplyr)
dados <- dados %>% gather(dia, resposta, starts_with("r"))

Then I would adjust a template as follows:

library(lme4)    
modelo <- glmer(resposta ~ explicativa + (0 + dia | id), data = dados, family = poisson)

So you will be considering that for each individual there is a random variation related to the day it is being measured.

    
24.08.2015 / 13:01