I'm running a zero-inflated, mixed-effects negative binomial model with the glmmTMB package in R.
My current format:
mod1 = glmmTMB(count ~ a + b + offset(c) + (1|d) + (1|e), ziformula= ~a, data = dat, family = nbinom2(link = 'log'))
I have noticed signs of temporal autocorrelation between count and variable "d" (which are individual years for a time-series dataset). Despite reading Kasper Kristensen's vignette, I'm still struggling to write a covariance structure using AR(1) ar1
. Do any of you have any suggestions please?
I understand the general structure is struc(terms|group)
. I'm assuming "d", or years, will be the terms
variable, but I'm unsure what I should use for group
? In other examples of AR(1) structure, I've seen people group only by year (e.g., form=~year
).
Thanks, Andrew