[R-sig-ME] Specifying a (random effect for an) interaction among two level 1 variables?

Emmanuel Curis emmanuel.curis at parisdescartes.fr
Wed Feb 21 09:11:19 CET 2018


Hello Joshua,

I think the answer depends on the interpretation of the underlying
model, which itself strongly depends on the nature of var1 and var2:
are they both quantitative (numeric), both qualitative (factors) or
one of each?

For the two numerics case, the fixed part model is
 µ = µ0 + a x + b y + c x y
not discussing the question of why assuming x² and y² do not act on µ,
 the interpretation of the random part is
 ( x | group ) -> random effect on µ0 and a
 ( y | group ) -> random effect on µ0 (again) and b
 ( x:y | group ) -> random effect on µ0 (again) and c

so having the three terms like it seems to make a difficult to
identify model (with three different random effects on µ0) with a
special covariance matrix between the random effects which is
block-diagonal.  The difficulty to identify may explain the problems
you have.

The more generic way to enter the model would be
     z ~ x + y + x:y + (x + y + x:y | g )
for a full covariance matrix between the 4 random effects (one for
each coefficient of the model), but you'll need to have plenty of
data for that.

A less generic model with independant random effects (but that's
questionnable, see previous discussions on this list) would be
     z ~ x + y + x:y + (x|g) + (0+y|g) + (0+x:y | g) )
that gives you 4 random effects with a diagonal covariane matrix.



For the one factor, one numeric case, assuming the factor has two
levels A1 and A2, then the model for the fixed part is
 µ = µ0(A1) + dA 1(A2) + [b(A1) + db 1(A2)] y
where 1(l) the indicator of level l, and x is the factor.

The interpretation of the random part is
 ( x | group )   -> random effect on µ0 and dA
 ( y | group )   -> random effect on µ0 and b
 ( x:y | group ) -> random effect on µ0, b, dA and db

so the situation is even worse than above when letting in the three
terms... The last one, ( x:y | group ), is enough to have random
effects on all coefficients of your model (with a full covariance
matrix between them)

The two factors case is similar, with the additional difficulty of
interpretating the meaning of these random effects in terms of inequal
variances of the random effect between the differents cells of your
table...

Hope this helps,
Best regards

On Tue, Feb 20, 2018 at 07:21:36PM -0500, Joshua Rosenberg wrote:
« Hi R-sig-mixed-models,
« 
« I have a question about specifying a random effect for the interaction
« among two level 1 variables when there are random slopes for each of the
« variables.
« 
« In short, *does specifying a random slope for both of the two variables
« used in the interaction imply that the effect of the interaction is also
« random across the level 2 units?*
« 
« Here's what the model (in lme4) looks like:
« 
« lmer(outcome ~ var1 + var2 + var1:var2 + (var1 | grouping_factor) + (var2 |
« grouping_factor), data = d)
« 
« 
« In the context of this model, I'm curious about whether the var1:var2
« interaction term varies across the level 2 units. Intuitively, it makes
« sense to me that it would, since the effects of its two components are
« allowed to vary across the levels of the grouping factor, but I'm having
« trouble thinking through it.
« 
« To give a bit more insight into my thinking, I tried something like the
« following, but it didn't work (the model didn't converge):
« 
« lmer(outcome ~ var1 + var2 + var1:var2 + (var1 | grouping_factor) + (var2 |
« grouping_factor) + (var1:var2 | grouping_factor), data = d)
« 
« 
« Thank you in advance.
« 
« -Josh
« 
« -- 
« Joshua Rosenberg, Ph.D. Candidate
« Educational Psychology
« &
«  Educational Technology
« Michigan State University
« http://jmichaelrosenberg.com
« 
« 	[[alternative HTML version deleted]]
« 
« _______________________________________________
« R-sig-mixed-models at r-project.org mailing list
« https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-- 
                                Emmanuel CURIS
                                emmanuel.curis at parisdescartes.fr

Page WWW: http://emmanuel.curis.online.fr/index.html



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