Solved – Including time as a continuous predictor and as a categorical random effect in mixed model

lme4-nlmemixed modelpoisson-regressionrepeated measurestime series

I am analyzing plant densities (n° of plants/0,36m²) across 5 different treatments (repeated on two blocks) in time (year and season). Since my outcome is plant density and repeated measures were done, I wish to analyze the data with a mixed model with a Poisson distribution.

However, on each block:plot:year:season, more than one quadrat was realized, i.e. I have more than one value of plant density for each block:plot:year:season in order to account for the within field variability. Moreover, I am interested in i) a time trend so I wish to include year as a fixed continuous predictor and 2) comparing plant densities between seasons. Hence, I was wondering if it was recommendable to include year as a fixed continuous predictor and a random categorical variable (in order to account for the fact that quadrats realized at the same sampling season on each plot are not independent).

My model (in R) with the glmer function would be the following:

mod = glmer(density ~ treatment*as.numeric(year)*season+(1|plot/as.factor(year)/season),
            family="poisson",data=dat)
  1. Could anybody specify whether this recommendable or not?
  2. Considering the quadrats are fixed within a block:plot:year:season, should I also add a quadrat ID? However, this would result in single observations per combination…

Best Answer

I think it's fine to include year as both fixed and random. This has been discussed a bunch, here are a few links that might help you think about justifying including the same variable as both random and fixed in the same model:

https://stats.stackexchange.com/q/155056

https://dynamicecology.wordpress.com/2015/11/04/is-it-a-fixed-or-random-effect/#comment-45407

Mixed Effects Model with Nesting

Related Question