[R-sig-ME] Specifying Random Effects For Multiple Cross-Level Interactions

David Jones david.tn.jones at gmail.com
Tue Apr 12 17:10:53 CEST 2016


I have a question about cross-level interactions in lmer which is a novice
one, but I cannot find examples online to address this in lmer because most
examples only focus on 1 cross-level interaction at a time.

I am trying to look at a model with 4 L1 variables, 4 L2 variables, and a
cross-level interaction between each respective pair (for 4 total
interactions). I have tried to specify the models in lmer, but have had
problems with the models and understanding why the errors occur. I have
searched these archives, and also used Doug Bates's slides and the lme4
wiki, among other resources.

As a preface, my sample is small (N=61, 29 clusters). L1 units (Xs) are
nested under site (between-subjects variables are the Ws). I would prefer
to use mixed-effects models if possible given precedent in my field. Here
are the the models I have tried:

For this first model, I get near perfect correlations between each set of
random intercepts/slopes (from looking at resources, it is probably because
my model has too many random effects). Syntax for the model as well as the
output for random effects is below.

model1 <- lmer(y ~ x1 + x2 + x3 + x4 + w1 + w2 + w3 + w4 +
                   x1:w1 + x2:w2 + x3:w3 + x4:w4 +
                   (x1 | site) + (x2 | site) + (x3 | site) + (x4 | site),
data = dataset,
                 REML=FALSE)

Random effects:
 Groups      Name          Variance   Std.Dev.   Corr
 site        (Intercept)   0.000e+00  0.000e+00
             x1   	   7.594e-14  2.756e-07  NaN
 site.1      (Intercept)   9.916e+00  3.149e+00
             x2   	   5.444e+01  7.378e+00  1.00
 site.2      (Intercept)   0.000e+00  0.000e+00
             x3   	   1.965e-11  4.433e-06  NaN
 site.3      (Intercept)   1.262e-01  3.553e-01
             x4   	   2.262e+00  1.504e+00  1.00
 Residual

Given this, I tried a different model with only 1 random intercept and a 1
random slope for each L1 variable (which are uncorrelated with intercepts
or each other). This runs (the first model I listed didn't converge for one
of my DVs; all of these examples have output associated with the same DV).
But, I often get perfect 0s for the random effects for the slopes (not even
a very, very small number like 7.2e-10, but rather literally 0.000 for the
variance and its SD, as if the random slopes are perfectly multicollinear).
Syntax and output are below.

model2 <- lmer(y ~ x1 + x2 + x3 + x4 + w1 + w2 + w3 + w4 +
                   x1:y1 + x2:y2 + x3:y3 + x4:y4 +
                   (1 | site) + (0 + x1 | site) + (0 + x2 | site) + (0 + x3
| site) + (0 + x4 | site), data = dataset,
                 REML=FALSE)


 Random effects:
 Groups      Name              Variance     Std.Dev.
 site            (Intercept)        4.091         2.023
 site.1         x1                     0.000         0.000
 site.2         x2                     0.000         0.000
 site.3         x3                     0.000         0.000
 site.4         x4                     0.000         0.000
 Residual                            53.150       7.290

If I specify a model with fewer effects, I do get non-negligible random
slopes, but the correlation between random effects generally is still
perfect.

model3 <- lmer(y ~ x1 + x2 + x3 + x4 + w1 + w2 + w3 + w4 +
                   x1:y1 + x2:y2 + x3:y3 + x4:y4 +
                   (x1 | site), data = dataset, REML=FALSE)

 Random effects:
 Groups    Name            Variance   Std.Dev.   Corr
 site          (Intercept)      10.01       3.164
                 x1                  55.76       7.467        1.00
 Residual                        46.04       6.785

Finally, if I tried to let estimate all random effects and let them covary,
the model won't run R indicates that there are way too many random effects
to estimate - syntax for this is below:

model3 <- lmer(y ~ x1 + x2 + x3 + x4 + w1 + w2 + w3 + w4 +
                   x1:y1 + x2:y2 + x3:y3 + x4:y4 +
                   (1 + x1 + x2 + x3 + x4 | site), data = dataset,
REML=FALSE)

The main thing that is confusing me is, for each cross level interaction,
shouldn't I need a random slope for each L1 predictor? My main question
then is, how should I address this situation?

I recognize there is something I must be doing wrongly as I am new to
cross-level interactions. I must be specifying redundant intercepts/slopes
at some point. As secondary questions, what do the multiple intercepts
represent that were obtained from the first model, and why are there
multiple listings for site when specifying uncorrelated random effects
(e.g., site.1, site.2, etc.)?

Many thanks for your input.

	[[alternative HTML version deleted]]



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