# Why is there an odd output result when adding an interaction term to a linear model

I run two lmer tests, one with and one without the interaction term between fixed effects. The problem is that the former gives an output result that makes no sense to the actual data (i.e. negative slope instead of positive), whereas the latter shows the expected output. Why does this happen and even though the interaction is significant (and also makes sense) does it mean that I should not include it in the model due to wrong output? Would it be better to run a model with only the fixed factors and another with the interaction term alone?

Below is the models and their outputs. Thank you!

(WITHOUT INTERACTION TERM)

mTEST<- lmer(amp.sqrt~ treatment + time + axis + (1+treatment|ID))
summary(mTEST)
Linear mixed model fit by REML
t-tests use  Satterthwaite approximations to degrees of freedom ['merModLmerTest']
Formula: amp.sqrt ~ treatment + time + axis + (1 + treatment | ID)

REML criterion at convergence: 5682.2

Scaled residuals:
Min      1Q  Median      3Q     Max
-2.2769 -0.7678 -0.0236  0.6049  3.5182

Random effects:
Groups   Name        Variance Std.Dev. Corr
ID       (Intercept)  602.8   24.55
treatment2  1028.9   32.08    -0.14
treatment3   283.2   16.83    -0.03  0.52
Residual             2027.6   45.03
Number of obs: 540, groups:  ID, 21

Fixed effects:
Estimate Std. Error      df t value Pr(>|t|)
(Intercept)  115.184      7.546  36.300  15.265  < 2e-16 ***
treatment2     2.644      8.571  18.400   0.308  0.76117
treatment3    23.365      6.139  19.200   3.806  0.00117 **
time7         13.958      4.707 474.800   2.965  0.00318 **
time8         21.799      4.787 478.500   4.554  6.7e-06 ***
axis2         60.458      4.746 474.800  12.737  < 2e-16 ***
axis3        128.456      4.746 474.800  27.063  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
(Intr) trtmn2 trtmn3 time7  time8  axis2
treatment2 -0.287
treatment3 -0.299  0.506
time7      -0.312  0.000  0.000
time8      -0.314  0.013  0.008  0.492
axis2      -0.315  0.000  0.000  0.000  0.000
axis3      -0.315  0.000  0.000  0.000  0.000  0.500


(WITH INTERACTION TERM)

mTEST2<- lmer(amp.sqrt~ treatment * time + axis + (1+treatment|ID))
summary(mTEST2)
Linear mixed model fit by REML
t-tests use  Satterthwaite approximations to degrees of freedom ['merModLmerTest']
Formula: amp.sqrt ~ treatment * time + axis + (1 + treatment | ID)

REML criterion at convergence: 5615.6

Scaled residuals:
Min      1Q  Median      3Q     Max
-2.7117 -0.7237 -0.0390  0.6140  3.3017

Random effects:
Groups   Name        Variance Std.Dev. Corr
ID       (Intercept)  619.0   24.88
treatment2  1061.1   32.58    -0.16
treatment3   296.4   17.22    -0.06  0.54
Residual             1879.0   43.35
Number of obs: 540, groups:  ID, 21

Fixed effects:
Estimate Std. Error      df t value Pr(>|t|)
(Intercept)       130.587      8.417  55.500  15.515  < 2e-16 ***
treatment2         -3.766     10.713  44.500  -0.352   0.7269
treatment3        -14.929      8.851  83.600  -1.687   0.0954 .
time7              -7.697      8.120 471.000  -0.948   0.3436
time8              -2.628      8.120 471.000  -0.324   0.7464
axis2              60.458      4.569 471.000  13.232  < 2e-16 ***
axis3             128.456      4.569 471.000  28.113  < 2e-16 ***
treatment2:time7    9.697     11.206 471.000   0.865   0.3873
treatment3:time7   53.206     11.206 471.000   4.748 2.73e-06 ***
treatment2:time8    8.554     11.396 473.700   0.751   0.4532
treatment3:time8   62.411     11.289 473.300   5.528 5.35e-08 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
(Intr) trtmn2 trtmn3 time7  time8  axis2  axis3  trt2:7 trt3:7 trt2:8
treatment2  -0.448
treatment3  -0.479  0.515
time7       -0.482  0.379  0.459
time8       -0.482  0.379  0.459  0.500
axis2       -0.271  0.000  0.000  0.000  0.000
axis3       -0.271  0.000  0.000  0.000  0.000  0.500
trtmnt2:tm7  0.349 -0.523 -0.332 -0.725 -0.362  0.000  0.000
trtmnt3:tm7  0.349 -0.275 -0.633 -0.725 -0.362  0.000  0.000  0.525
trtmnt2:tm8  0.344 -0.514 -0.327 -0.356 -0.712  0.000  0.000  0.492  0.258
trtmnt3:tm8  0.347 -0.272 -0.628 -0.360 -0.719  0.000  0.000  0.261  0.496  0.512


The meanings of the fixed effects change when you add an interaction, and often it makes no sense to interpret the main effects in the presence of an interaction

Without the interaction, the fixed effects can be interpreted on their own. In your first model, without the interaction,treatment3 is the mean difference in amp.sqrt between the treatment1 group and the treatment3 group with the other variables held constant.

However, with the addition of the interaction treatment:time, treatment3 is now the mean difference in amp.sqrt between the treatment1 group and the treatment3 group with the other variables held constant, but in particular with time held equal to it's reference level.

In order to ascertain whether it makes any sense at all to interpret the main effects in the presence of the interaction it is important to understand the data. As mentioned above, the main effect for treatment3 now means the difference between the treatment3 and treatment1 group, when time is at it's reference level(-14.929). The interactions then give the additive differences for each combination of levels of the factors.

So we can arrive at these interpretations of your output:

For treatment1 at time6, we have amp.sqrt = 130.587

For treatment2 at time6, we have amp.sqrt = 130.587 - 3.766

For treatment3 at time6, we have amp.sqrt = 130.587 - 14.929

For treatment1 at time7, we have amp.sqrt = 130.587 - 7.697

For treatment2 at time7, we have amp.sqrt = 130.587 - 7.697 - 3.766 + 9.697

For treatment3 at time7, we have amp.sqrt = 130.587 - 7.697 - 14.929 + 53.206

For treatment1 at time8, we have amp.sqrt = 130.587 - 2.628

For treatment2 at time8, we have amp.sqrt = 130.587 - 2.628 - 3.766 + 8.554

For treatment3 at time8, we have amp.sqrt = 130.587 - 2.628 - 14.929 + 62.411

If this still seems "odd" to you, then a simple plot may make help to make more sense of it:

So to pull the discussion back to your question "Why is there an odd output result when adding an interaction term", I would say that there doesn't appear to be anything odd. The main effects just have a different interpretation, which is not particularly useful: So looking again at the treatment3 -14.929 estimate, this means that the response is 14.9 units lower in the treatment3 group, than the treatment1 group at time=6, as indicated on the plot. Moreover, if we look at the output for the model without the interaction, there are positive estimates for the time and treatment variables. This is consistent with the above plot because we see from the plot that on average there is an increasing trend in the response with increasing time (consistent with the positive estimates in the no-interaction model for time). Also, on average the lines on the plot fortreatment1 and treatment2 are similar to each other (consistent with the fixed effect of treatment2 in the no-interaction model being small), while on average the line for treatment3 is much higher than that for the other treatments (consistent with the large fixed effect for treatment3 in the no-interaction model).

• Hi Robert, thank you for your detailed reply! I have a further question based on what you explained, which is too long to post as comment so I will put it below as an answer to my question- I would highly appreciate your help/advice on that last step! – BeStats Jul 31 '16 at 14:44
• You're welcome, but please don't post another question as an answer to this question. Please post a completely new question about how to report your results. This will keep the site easier to use for others. And f you think that my answer here answers your original question, please mark it as the accepted answer. – Robert Long Jul 31 '16 at 14:59
• I have now marked your answer as the accepted answer and also asked a separate question on the reporting of results originating from such interaction vs no-interaction models. Any help with that would be highly appreciated! Thank you again! – BeStats Jul 31 '16 at 15:21
• @BeStats great - I will take a look and try to answer a little later today. – Robert Long Jul 31 '16 at 15:48