[R-SIG-Finance] Estimating hour-of-day effects for count timeseries
Markus Loecher
markus at insightfromdata.com
Mon Apr 21 16:09:55 CEST 2008
Dear all,
I am trying to model the hour-of-day effect of an overdispersed timeseries
of count data with a negative binomial distribution.
A toy example would be the following code sniplet, where x represents the
hour of day (1-24).
x <- rep(1:24,50);
x.df <-
cbind.data.frame(y=rnbinom(length(x),mu=10*abs(sin(2*pi*x/24)+1.5),size =
2),x=x);
x.glm <- glm(y~factor(x)-1,data = x.df, family=quasipoisson);
While this works fine to model overall overdispersion, I would also like to
set up a model with a different estimated overdispersion parameter for each
level of x.
And when that is all done, I would like to conduct some ANOVA type model
comparison between this saturated model and the sparse model.
Do I need to switch to mixed effects models, such as lmer() ?
Thanks !
Markus
More information about the R-SIG-Finance
mailing list