I am trying to model a variable (maximum depth) as a function of type of dive and diel changes (day,night) with the individuals (whales in this case) as a random factor in R. I tried first to apply a linear mixed model (lme
) and I had a problem of autocorrelation and non-normality of residuals. Next, I tried to apply a GLM with Poisson and negative binomial distributions. Both had the same problem of autocorrelation and/or non-normality of residuals.
What can I do to model these variables or to correct these issues?
Thank you.
Update
I tried using corAR1(correlation = corAR1(form = ~ 1 | whale))
but when I plot ACF, there is still a strong autocorrelation.
What can this mean and how could I proceed to solve it? I could not include time in the corAR1
function because of repeated diel values:
(Error in Initialize.corAR1(X[[i]], ...) : covariate must have unique values within groups for "corAR1" objects)
Thanks!