2

I have a dataset of traffic count at several intersections at various dates. Most of the intersections were counted only once. I want to know if there is a significant daily and monthly variability in peak hour volumes.

So I ran an ANOVA model in R that look like this:

fit<-lm(trafficcount~factor(year)+factor(month))+factor(day)+factor(month))*factor(day))

anova(fit)

Looking at p-values, I then conclude whether or not there is a significant variability among day or month or year. Is that an acceptable method to achieve that?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
jeake
  • 41
  • 2

1 Answers1

0

Your count variable trafficcount maybe Poisson distributed, so you could change your linear model for a poisson GLM (generalized linear model), or use the linear model with a square root transformed response variable $\sqrt{\text{trafficcount}}$. The square root transform is the variance stabilizing transform for the Poisson family, see Why is the square root transformation recommended for count data?. But the Poisson GLM approach is probably better.

In R the poisson regression would look like:

fit <- glm(trafficcount ~ factor(year) + factor(month) + factor(day) +          factor(month) * factor(day), family=poisson(link=log))

anova(fit)

To your additional question in the comment: If the time interval for counting is not constant for the sites, you can include the exposure time in the model as an offset: In R your formula would include ~ offset(log(exposure_time)) + factor(year) + .... Then the Poisson approach should be OK. But, you must be on alert for overdispersion, in R you can check for that using the quasipoisson family function.

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
  • 1
    Thanks! I should add that the time interval is not constant between to two sites. I do not think I can apply a Poisson distribution here, can I? – jeake Jun 14 '16 at 17:47
  • You can use a poisson (an alternative might be negative binomial). The difference in time interval (exposure) is taken care of the the offset. – kjetil b halvorsen Mar 21 '17 at 15:23