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!