Let's say you're trying to fit a model to a dataset that includes categorical variables, group (A or B) and treatment (1, 2, 3 or 4).

In R, your model formula would be DV ~ group * treatment (DV stands for dependent variable) and your model output will look like this:

(intercept)                 [...]
groupB                      [...]
treatment2                  [...]
treatment3                  [...]
treatment4                  [...]
groupB:treatment2           [...]
groupB:treatment3           [...]
groupB:treatment4           [...]

My question is how to interpret this kind of output. Below is what I believe is right for the interpretation of the main effects, and what puzzles me about the interaction parameters.


This the reference value, i.e. for treatment 1 in group A.


This is the difference between group A and group B for treatment 1 only.


This is the difference between treatment 1 and treatment 2, within group A only. It indeed still refers to the intercept value. Same logic for the two following estimates ("treatment3" and "treatment4").


Here is where I get puzzled. Is this testing if the difference between treatment1 and treatment2 is the same in groupB compared to groupA, or is it testing if if the difference between groupA and groupB is the same for treatment1 compared to treatment2.

I thought this question would be very basic, but I went through several R books with no luck and found inconsistent answers on here (see How to interpret 2-way and 3-way interaction in lmer? for support for the first idea and Interpreting the regression output from a mixed model when interactions between categorical variables are included for the other way).

If that matters, I'm working with the glmer function of the lme4 package.


  • 1
    $\begingroup$ Both actually. These cases can't be distinguished. $\endgroup$
    – Roland
    Jun 16, 2015 at 9:56
  • $\begingroup$ Have a look at the effects package $\endgroup$
    – James
    Jun 16, 2015 at 10:01
  • $\begingroup$ If visual inspection is helpful for you, you might want to check the sjp.int function of the sjPlot-package (see examples here). Maybe this blog-posting is also helpful. $\endgroup$
    – Daniel
    Jun 16, 2015 at 11:58

1 Answer 1


It think Roland in your comment is right. I guess it could be expanded as an answer. If you draw a table summing your coefficients for each case, you end up with something like that :

|      | treat1 | treat2 |
| gpb  |   a    |    b   |
| gpa  |   c    |    d   |

Treatement 3 is volontary omitted. You have :

  • $a=intercept+groupB$
  • $b=intercept+groupB+treatment2+groupB:treatment2$
  • $c=intercept$
  • $d=intercept+treatment2$

Your first proposition could be translated as studying $(b-a)-(d-c)$.
Detail : The difference between treatment1 and treatment2 in groupB $(b-a)$, compared to the difference between treatment1 and treatment2 in groupA $(d-c)$.

Similarly, your second proposition could be translated as studying $(b-d)-(a-c)$.

It's then the same expression, and it indeed equals $groupB:treatment2$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.