I am attempting to perform a logistic regression on longitudinal data (game camera footage of nesting birds, with a photo taken every 5 minutes for a period of 10-28 days, depending on whether the nest was abandoned part way through the nesting period or not). In total I have ~25,000 observations from 10 separate nests.
My overall goal is to determine the temperature at which these birds begin experiencing heat stress. I really don't care about the effect of time, I just want to control for the autocorrelation caused by the fact that this data is from a time-series. I've classified each photo in a binary manner according to whether the bird on the nest is displaying thermoregulatory behavior (0=no thermoregulatory behavior displayed, 1=thermoregulatory behavior displayed). For each photo, I have simultaneously collected weather station data, so that I can say "When it was X degrees out, the bird on the nest was displaying/not displaying thermoregulatory behavior." I have other climate data as well (humidity, wind speed, precipitation rate, etc.) that goes with each photo. I've used a hierarchical model selection approach (using mixed effects models to control for the random effect of nest site, since I have multiple photos of the individual at each site). I've found that my best model is:
Model8 <- glmer(ThermalResponse ~ Temperature + Humidity + (1 | Location),
data = thermoreg, family = binomial())
I've run into a few problems: Ideally, I would like to control for nesting territory (since I have multiple observations from each individual). However, there is definitely autocorrelation in my residuals (see plot below).
I've tried multiple approaches to correct for this, but from what I've read, it is not possible to incorporate both autocorrelation and a random effect into the same model. I tried doing so using the lme function from the
nlme package (THe model I used was:
Model1<-lme(ThermalResponse~Temperature+Humidity, data=thermoreg, random=~1|Location, correlation=corAR1(form~1|TimeSeries))
, but when I specified the model, it ran and ran (for over 24 hours!) and I eventually canceled it.
I've also tried the
bild function (from the
bild package), but I've received several errors that I cannot find documentation for anywhere.
In addition to those approaches, I've tried changing the structure of my data-instead of using the individual photos, I've averaged the response and predictor variables over different time periods (1 hour, 2 hours, 4 hours) and performed a proportional logistic regression in order to try to remove the autocorrelation, however it did not help with the autocorrelation (see the plots below, which show the acf plot for the 2-hour and 4-hour proportional logistic regression models).
I'm at a loss for what to do/try next. Any advice is greatly appreciated!