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?