I was hoping to obtain some guidance for the specification of a mixed
model in the following analysis that I have been trying to do with
glmmPQL. My problem is that I am unsure on how to specify multiple random
effects associated with different
covariates at different spatial scales.
* Response variable: a integer variable Y that are counts of birds in a
route over time (12 years, one count per year, there might be temporal
autocorrelation, hence my interest in using the library nlme)
* Explanatory variables : three continuous variables measured over
time: X is measured at the route level and W and Z are measured at the
regional level (there are many >10 routes in each of the 24 regions)
* The goal: to determine the extent to which Y (at the route level) is
determined by X,W and Z, knowing that each covariate was estimated at
different spatial scales (route, region), and that each of these
scales are organized in a nested manner (routes within regions)
I have been trying to fit the model with lmer:
lmer(Y~X+W+Z + (X|region/route)+(W|region)+(Z|region), method="REML",
data=ac, family=poisson)
and it seems to be doing the right things, though I am not 100% sure
that I am correctly specifying that each explanatory variable is
measured at different spatial resolution. Any words of wisdom would be
appreciated.
However, when passing to glmmPQL (because I need to test for temporal
autocorrelation), I am encountering problems to fit the very same model
(asumming that it is correct). I have tried:
glmmPQL(Y~X+W+Z, random= list(~X|region/route, ~W|region,~Z|region) and I
obtain an error message
Error in logLik.reStruct(object, conLin) :
NAs in foreign function call (arg 2)
In addition: Warning messages:
1: In ncols * isLast :
longer object length is not a multiple of shorter object length
2: In ncols * c(rep(1, Q), 0, 0) :
longer object length is not a multiple of shorter object length
I have also tried :
glmmPQL(Y~X+W+Z, random= (X|region/route +W|region+Z|region) and though
it gives an answer, I am far from certain to know what it does.
Before posting this message, I have read most of the threads of this
list, searched for help in general forums of R, and looked at the main
textbooks (Pinheiro & Bates and others) without much success.
To rephrase the question: how to specify the structure of random
effects to specify multiple random effects associated with different
covariates at different spatial scales?
Many thanks for any help/suggestions
Sincerely,
Pablo Inchausti