I have response data measured at the site and month level. I wish to fit a year trend to the data and month to remove the seasonal trend. However, to avoid pseudoreplication, I have fitted year also as a random effect.
My model using the lme function in R (package nlme) looks like:
lme(Response ~ Year + Month, method="REML", random = ~ 1|Year/Site, data=data1)
I then wish to fit an AR(1) function to look at the correlation between months. The lme function demands that the correlation structure be nested within the random effects structure, such that the model now looks like:
lme(Response ~ Year + Month, method="REML", random = ~ 1|Year/Site, correlation=corAR1(value=0.1,form=~autor|Year/Site), data=data1)
The term 'autor' is used as a running month term. However, given that the correlation structure is nested within the random effects structure, the correlation between the first response in year i and the last response in year (i-1) is not taken into account in the autocorrelation estimation. My questions are as follows:
1) Is there a specific reason why the correlation structure cannot be fitted across the random effects (ie years in this case) and must be nested within its structure? Would this conflict with the random effects standard deviation estimation?
2) Is there a way to fit an AR(1) with crossed random effects? I have not been able to fit such a model with lme so far.
Best Answer
You're fitting both a random and fixed effect for the year variable. This is not very likely. Chances are that either fixed effect is measured near zero or that std of random effect is near zero. Than use one of these formulas (which i suspect you actually want):
Measuring continuous yearly trend:
Measuring a separate response for each year: