Is a repeated measures Poisson regression for rates the correct test, and how to perform in R I am studying wildlife use of overpasses across three seasons and I believe a Poisson regression for rates with repeated measures is the correct analysis to use, but I am not sure how to include repeated measures in the R code, and I want to make sure this analysis correctly addresses my research question!
Study design:
I placed remote cameras at 40 overpass crossing structures to capture photos of wildlife crossing a canal over one year. The year is broken into three seasons (hot-dry, hot-wet, and cool-wet). The three seasons are each different lengths (hot-dry: 61 days, hot-wet: 123 days, cool-wet: 182 days).
Research question:
Does crossing frequency vary among the three seasons?
Data:
Each site is associated with a total number of crossings for a given species in each season. Each season is associated with a different length of time. Below is an example of how my data is set up. In reality I have 40 sites, and the # crossings displayed below are made up.




Site
Season
# crossings
Active days




A
Hot-Dry
10
61


B
Hot-Dry
12
61


C
Hot-Dry
16
61


A
Hot-Wet
22
123


B
Hot-Wet
25
123


C
Hot-Wet
33
123


A
Cool-Wet
67
182


B
Cool-Wet
70
182


C
Cool-Wet
81
182




Because I am using count data, I chose a Poisson regression. Because I need to account for different lengths of time in each season, I decided on a Poisson regression for rates (I included an offset for active days). I know my data are not independent because I am sampling the same sites in each season, so I believe I need to add in a repeated measures function. I am performing the analyses in RStudio.
The code (without the repeated measures function) I have used is:
model <- glm(Crossings ~ Season + offset(logdays), 
    family = poisson(link = "log"), data = data)

My questions are:

*

*Does this seem like the correct approach?

*How do I add a repeated measures function into the model?

As a note, I have also looked into the Friedman Test and that is a backup option. For that test, I would calculate the crossing rate for each site in every season (# crossings/active days) and test crossing rate ~ season with site as the blocking variable. Maybe this makes more sense?

The Poisson model is a good way to start with count data. Sometimes the variance around the model predictions is greater than what you might expect from a Poisson model, so you might need to move to a negative binomial model or use a "quasi-Poisson" model that adjusts for the extra variance. There are many pages about those alternatives on this site.
A simple way to incorporate the repeated measurements per Site would be to treat Site as a random effect in a mixed-effects Poisson model. With the R lme4 package you would write a similar model to what you have:
model <- glmer(Crossings ~ Season + offset(logdays) + (1|Site), 
              family = poisson(link = "log"), data = data)

The (1|Site) term allows for different baseline rates among sites, modeled with a Gaussian distribution. That uses up a lot fewer degrees of freedom than trying to treat 40 sites as individual fixed effects.
