[R-sig-ME] multiple random effects in lmer and glmmPQL

Mike Dunbar mdu at ceh.ac.uk
Thu Jul 3 10:32:51 CEST 2008

Dear Pablo

You may be trying to make things too complicated. Are you interested purely in random intercept components or random slopes with respect to particular covariates as well? Providing you are just interested in random intercepts then your model structure then your model would simply be:

lmer(Y~X+W+Z + (1|region/route), method="REML", data=ac, family=poisson)

lmer will correctly deduce from the way that the covariates vary with the groups that X is at a different level from W and Z. If you really are interested in testing for random slopes then it looks like you have quite a complicated model, it is still worth starting with the simpler models to explore the data then you may need to consult with a professional statistican face to face.



>>> logodall <logodall at yahoo.fr> 02/07/2008 16:46 >>>
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

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
Pablo Inchausti


	[[alternative HTML version deleted]]

R-sig-mixed-models at r-project.org mailing list

This message (and any attachments) is for the recipient ...{{dropped:6}}

More information about the R-sig-mixed-models mailing list