I am really stunned by the fact that the Poisson GLM accepts non-integer numbers! Look:
Data (contents of data.txt
):
1 2001 0.25 1
1 2002 0.5 1
1 2003 1 1
2 2001 0.25 1
2 2002 0.5 1
2 2003 1 1
R script:
t <- read.table("data.txt")
names(t) <- c('site', 'year', 'count', 'weight')
tm <- glm(count ~ 0 + as.factor(site) + as.factor(year), data = t,
family = "quasipoisson") # also works with family="poisson"
years <- 2001:2003
plot(years, exp(c(0, tail(coef(tm), length(years)-1))), type = "l")
The resultant year index is as "expected", i.e., 1-2-4
in years 2001-2003
.
But how is it possible that Poisson GLM takes non-integer numbers? The Poisson distribution has always been integer-only!
family="poisson"
as well, but note that your example isn't a Poisson GLM, as you're using thequasipoisson
family, which only depends on the relationship between the mean and the variance anyway, so in that case, there should be no surprise about taking non-integer numbers. $\endgroup$