# Interpreting the regression output from a mixed model when interactions between categorical variables are included

I have a question about my use of a mixed model/lmer. The basic model is this:

lmer(DV ~ group * condition + (1|pptid), data= df)


Group and condition are both factors: group has two levels (groupA, groupB) and condition has three levels (condition1, condition2, condition3). It's data from human subjects, so pptid is a random effect for each person.

The model found the following with p value output:

                                   Estimate MCMCmean HPD95lower HPD95upper  pMCMC Pr(>|t|)
(Intercept)                          6.1372   6.1367     6.0418     6.2299 0.0005   0.0000
groupB                              -0.0614  -0.0602    -0.1941     0.0706 0.3820   0.3880
condition2                           0.1150   0.1151     0.0800     0.1497 0.0005   0.0000
condition3                           0.1000   0.1004     0.0633     0.1337 0.0005   0.0000
groupB:condition2                   -0.1055  -0.1058    -0.1583    -0.0610 0.0005   0.0000
groupB:condition3                   -0.0609  -0.0612    -0.1134    -0.0150 0.0170   0.0148


Now, I know that the rows listed compare each level of the factors to the reference level. For group, the reference is groupA and for condition, the reference is condition1.

Would I be correct in interpreting this output in the following way:

• No overall differences between the groups (hence groupB having a p of >.05)
• Overall differences between condition 1 and condition 2, and between condition 1 and condition 3.
• Differences between groupA, condition 1 versus groupB, condition 2 and also between groupA, condition 1 versus group B, condition 3.

Is that correct? I think I'm a little confused about how to interpret this with regards to interactions between levels of two different factors.

I've read various questions on here and done some web searches, and managed to get contrasts set up with glht: would that be a better way to look at the differences between the groups and conditions? I figured that would be the case given the signs of interactions being present here.

-
But, if we want to compare Group=B to the reference level Group=A when Condition=2 (or 3)? It is possible? And, I feel that compare if "the difference between Condition1 and Condition2 is different when Group=A vs. Group=B" is the same of compare if "the difference between Group=A and Group=B is different when Condition1 vs. Condition2". Is that correct? otherwise, what are their p-values​​? –  Rosana Aug 16 at 0:00
This does not look like an answer to the question. Rather, you have a new question. Best to post as such. –  Nick Cox Aug 16 at 0:24

Using the given regression table, we can compute the table of expected value of the dependent variable, DV, for each combination of the two factors, which might make this more clear (Note I've used the ordinary estimates, not the MCMC estimates):

$$\begin{array}{c|cc} \phantom{} & {\rm GroupA} & {\rm GroupB} \\ \hline {\rm Condition1} & 6.1372 & 6.0758 \\ {\rm Condition2} & 6.2522 & 6.0853 \\ {\rm Condition3} & 6.2372 & 6.1149 \\ \end{array}$$

No overall differences between the groups (hence groupB having a p of >.05)

The $p$-value you're referring to is only restricting focus to the reference level of the variable Condition , so it's only testing the difference between the groups when Condition=1 (the first row of the table), i.e. it's only testing whether $6.1372$ is significantly different from $6.0758$.

It's not testing whether there is an overall difference between the groups. To do that test, you'd have to leave Condition out of the model entirely and test the significance of Group.

Overall differences between condition 1 and condition 2, and between condition 1 and condition 3.

Similarly to the first interpretation, this is only comparing Condition2 and Condition3 to the reference level (Condition1) when Group=A. That is, this is only testing whether the second and third entries in the first column are significantly different from $6.1372$. To test for overall differences in the condition variable, you'd need to leave Group out of the model and test condition alone.

Differences between groupA, condition 1 versus groupB, condition 2 and also between groupA, condition 1 versus group B, condition 3.

The interaction terms test whether the effect of one variable depends on the level of the other variable.

For example, significance of the groupB:condition2 term tells you that difference between Condition1 and Condition2 is different when Group=A vs. Group=B. Referencing the table, this means that $$6.2522-6.1372=.115$$ is significantly different from $$6.0853-6.0758=.0095$$ In this particular case it looks like Condition2 is different from Condition1 in GroupA but much less so in GroupB, and that's how I'd interpret this. It appears a similar dynamic is occurring, to a lesser extent, with regard to Condition3.

-
This is a fantastic response: many, many thanks for taking the time to put it together! In your opinion, would there therefore be little point in running follow-up contrasts for something like this? –  vizzero Aug 18 '12 at 12:12
You're very welcome @vizzero! In this case, it looks like all of the comparisons of interests are in the model, so I'm not sure what the purpose of post-hoc tests would be. Also, since we see significant interaction, the importance of comparing of the group means (e.g. Group A vs. Group B, ignoring Condition) is not clear to me. –  Macro Aug 19 '12 at 13:30
Great response, @Marco. Do you know a function that test the overall effect of all predictors specified in a model automatically without having to specify and test each submodel by hand? –  crash Apr 29 at 10:56
@crash, I guess it depends on what you mean by the "overall effect of all predictors". If you have several predictors $(x_1, ..., x_p)$, one way to interpret your question is to suggest comparing the "saturated" model, which allows the most general possible relation between the outcome, $y$, and the predictors: $$E(y|x_1, ..., x_p) = f(x_1,...,x_p)$$ with the model where this expectation does not depend on the predictors at all, i.e. $f(x_1,...,x_p) \equiv c$ for some constant $c$. How to operationalize this depends on various things, e.g. whether your predictors are continuous or categorical. –  Macro May 18 at 2:53