Skip to content

lme4 - equal estimates of regression coefficients across levels of a random effect

4 messages · Nicolas Deguines, Thierry Onkelinx, Ben Bolker

#
Dear lme4 authors & users,

I?m a postdoctoral research scholar working on the effect of
precipitation on the food web of a grassland semi-arid ecosystem in
California.

I am analyzing my dataset with version 1.1-7 of the lme4 package with
version 3.2.0 of R.
I encountered an issue while running a glmer model that includes
random effects from a categorical variable (?year?, 2010 and 2011) on
the slope of four explanatory variables.
Precisely, the estimated slope coefficients for 1 out of 4 explanatory
variables are identical in the two years. However, when running a
model including only this particular explanatory variable and the same
random effect from year on slope, estimates are different for the two
years (indeed, I did check that values are different in the two years.

It also happens for other models I?m running, e.g. with that
particular explanatory variable + two new ones: this time though, the
slope coefficients are different for that particular variable but
identical for the two new ones (nb: the response variable in this
model differs from the 1st model discussed).

Is this an issue that already occurred to other lme4 users? Any idea
about what I may be doing wrong?
I suspect it may come from the syntax of my models. I had fitted my model as:
glmer(response ~ x1 + x2 + x3 + x4 +(x1|year) +(x2|year) +(x3|year)
+(x4|year), ? )
But I tried the following model:
glmer(response ~ x1 + x2 + x3 + x4 +(x1 + x2 +x3 +x4 | year), ? )
it does estimate different slope coefficients for each year.
I don?t know what meanings are associated with these two different
syntaxes though, and I would really appreciate any information or
reference anyone can give to clarify this.

I would be glad to provide additional information that may be needed
about the models or the dataset.

I take the opportunity while writing this email to thank lme4 authors
for developing and improving the very useful package that is lme4!

Best regards,
Nicolas Deguines
#
Dear Nicolas,

Those models are different, hence you get different results. Note that two
levels are not enough to get stable variance estimates for the random
effect. See glmm wiki FAQ.
Op 11-jun.-2015 18:39 schreef "Nicolas Deguines" <nicodeguines at gmail.com>:

  
  
11 days later
#
Thank you Thierry for the note and pointing out the the glmm wiki FAQ.

I understand the models are different but does anyone have more specifics
regarding the meaning of coding a random effect on the slope of multiple
fixed variables, ie what's the difference between:
glmer(response ~ x1 + x2 + x3 + x4 +(x1|year) +(x2|year) +(x3|year)
+(x4|year), ? )
and
glmer(response ~ x1 + x2 + x3 + x4 +(x1 + x2 +x3 +x4 | year), ? )

Best,
Nicolas


On Thu, Jun 11, 2015 at 10:17 AM, Thierry Onkelinx <thierry.onkelinx at inbo.be

  
  
#
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 15-06-22 03:21 PM, Nicolas Deguines wrote:
I would like to start by emphasizing Thierry's point that it really
doesn't make sense to fit a random effect for a grouping variable with
only two levels.  That said, for future reference:


  Your first model fits slope *and* intercept for each response
separately; you probably want

 (1|year) + (0+x1|year) + (0+x2|year) + (0+x3|year)+(0+x4|year)

*or*

  (1+x1+x2+x3+x4||year)

instead.  Each of these fits 5 variance parameters, *assuming* the
random effects are uncorrelated.

  (x1+x2+x3+x4|year)  fits a 5x5 (including the intercept term)
variance-covariance matrix.  It is more general and arguably better
because it is robust to recentering -- the meaning and predictions of
the independent-terms model if you subtract a constant value from any
of the predictors -- but it is also much more complex and so may
overwhelm your data or your computer.  (This comes up in the current
Bates et al. "Parsimonious mixed models" vs Barr et al (2013) "Keep it
maximal" debate ...)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJViGZvAAoJEOCV5YRblxUHTgQIAJ3L47BSSgYcezMByair6Oje
74VCPk3Dk9cBmOFp0PS+omafYOdjwGIA4lQ+wY05PHIrcpm7faIgdAZg9J3KPom5
WndhldlJ6s5pAFbqmiFmEHeAQwEC7J3Z9952xcEVo4YKGC6x2y7vUjgywNKLH9cN
Kx4WqYQ4JSY1aHeYAlWF10YIFz/oC0HaYsW1mNhc0tA5nl5dGOl5ZqHBqM3vH+Fq
wPhTaZZQEfqyxhR+QKFwivtt+eypV+5qP6+WbD49EQgwZfkC3ZDmWgmW6a2LzoTr
UCg+alD6fMDWFVltdtWpTH40zMMezBeBMmNGdPDMoNl3yODyEqxBj7AhmtXiBUs=
=NeFY
-----END PGP SIGNATURE-----