1
$\begingroup$

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:

  1. Does this seem like the correct approach?
  2. 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?

$\endgroup$

1 Answer 1

1
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ Hello, thank you very much for the reply. I ran the code for a species and am happy with the results so far. However, there is over dispersion in the model. As you suggested, I tried to run a quassi-Poisson model with the same line of code, but with family = quassipoisson. Unfortunately I received an error that quassi families cannot be used with glmer. Do I need to use a different package? $\endgroup$
    – Kaela
    Nov 15, 2022 at 0:08
  • $\begingroup$ Disregard the previous comment! I was able to figure out how to obtain the quassi-poisson estimates using this website (bbolker.github.io/mixedmodels-misc/…) that had been referenced in other similar questions. Thank you again for the help! $\endgroup$
    – Kaela
    Nov 15, 2022 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.