[R-sig-ME] Interactions and posthocs for LMER models

Antoine Tremblay trea26 at gmail.com
Tue Oct 20 21:55:08 CEST 2009

Hello all,
here's a question about interactions.
Let's just say you have the variables Diagnosis with two levels LI
(language impaired) and N (normals) and FreqGroup with two levels High
and Low. Then you have the following linear mixed-effects model:


the last line of the model summary (print(model1,corr=F) will give you
for the 2-way interaction the following:
                         Estimate    Std. Error   t value
DiagnosisN:FreqGroupLow  1.187e-04   4.022e-05    2.95

Considering that the intercept will embody
"DiagnosisLI:FreqGroupHigh", that is, the levels from each variable
that comes first in the alphabet, does this mean that the line above
giving you the estimate, std. error and t-value of the difference between
DiagnosisLI and DiagnosisN minus the difference between FreqGroupHigh
and FreqGroupLow?

Now, in order to determine whether DiagnosisN:FreqGroupHigh is
different from DiagnosisN:FreqGroupLow, you have to create the dummy
variable DiagFreq which has now four levels (LI.High, LI.Low, N.High,
and N.Low) and rerun a model with that dummy variable and then
relevel() to N.Low and look at the comparison with N.High (and apply a
Bonferroni correction for the number of comparisons you made). Is that

OK, say you have a slightly more complex model such as this one:

lmer(RT~Diagnosis*FreqGroup + Gender*FreqGroup+(1|Subject)+(1|Item),data=dat)

and say both interactions were significant. I don't know how I would
proceed to determine whether N-High is significantly different than
N-Low. That is, I will not be able to fit a model such as the one
below, where Diagnosis and FreqGroup are conjoined but FreqGroup is
present also and interacting with Gender:

lmer(RT~DiagFreq + Gender*FreqGroup +(1|Subject)+(1|Item), data=dat)

I thus tried conjoining Diagnosis, FreqGroup, and Gender into a
variable named DiagFreqGend with 8 levels now and contrast code so I
get only the N-High vs. N-Low, LI-High vs LI-Low and the interaction
(N-High minus N-Low) minus (LI-High-LI-Low). But it doesn't work. The
contrast matrix is singular and I get this error: Error in mer_finalize(ans) :
Downdated X'X is not positive definite, 6.

Maybe then I should use relevel() and look at the contrasts of interest only?

But then, what if the model becomes even more complex, such as the
following, where IQ_continuous is a continuous variable:

lmer(RT~Diagnosis*FreqGroup + Gender*FreqGroup + Handedness*FreqGroup +
IQ_continuous*FreqGroup +(1|Subject)+(1|Item), data=dat)

It's now impossible to make a super big conjoined variable because of

What is a (or the) way out of this?

Your help is well appreciated,
Antoine Tremblay

Antoine Tremblay
Department of Neuroscience
Georgetown University
Washington DC

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