I have asked a similar question here: stackoverflow I am puzzled by the interpretation for an interaction term. In my data my Y is an interval variable with the health outcome of an experiment. I have used an interaction term in which I have interacted the condition with the predisposition of the subject considering health status at base level. They are both categorical variables (factor variables in R).

Now it gets complicated because the Condition was two treatments: in treatment A subjects got the placebo first and then the real medicine whereas in treatment B they go the real medicine first and the placebo second. All it changes is the order.

Health outcome = a + Condition * Health.Base

I have the worst state of health at the base level as my reference category I find that interaction with the Condition is statistically significant but I am not sure how to interpret this.

I use the lm() function of R (although my design looks more like an ANOVA) and in the output I get the b coefficient in an output that looks like this:

ConditionB:Health.Base.So.and.So         (Beta and p-value)
ConditionB:Health.Base.Excellent         (Beta and p-value)

A statistically significant interaction term for those in Excellent health at baseline would mean that they are affected by the Condition B more than Condition A compared to the reference category people (Poor health at baseline). Is this right? What does the beta-coefficient represent?

If I would like to examine for each Health category at the base line separately without comparing to a reference category I would have to code each category as a dummy variable. However, in this case I would compare whether membership to a specific health status at the base line significantly changes between conditions compared to those who belong to the other health statuses at the base line. Is this right? Again, what does the beta-coefficient represent?

Would it be right to assume that the choice of the interaction between the Condition and the dummy variables is easier to interpret?

--- EDIT --- R output:

lm(formula = HealthOutcome ~ Condition * HealthStatus, 
    data = datA)

    Min      1Q  Median      3Q     Max 
-1.5957 -0.5942 -0.2640  0.4423  2.4423 

                                       Estimate Std. Error t value     Pr(>|t|)    
(Intercept)                            2.595652   0.053044  48.934  < 2e-16 ***
ConditionCondB                        -0.001449   0.077071  -0.019    0.985    
HealthStatusSo.and.So                 -0.331693   0.078094  -4.247  2.35e-05 ***
HealthStatusExcellent                 -0.836724   0.092692  -9.027  < 2e-16 ***
ConditionCondB:HealthStatusSo.and.So   0.137490   0.110612   1.243    0.214    
ConditionCondB:HealthStatusExcellent  -0.199787   0.133943  -1.492    0.136    
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.8045 on 1059 degrees of freedom
  (68 observations deleted due to missingness)
Multiple R-squared:   0.16, Adjusted R-squared:  0.156 
F-statistic: 40.33 on 5 and 1059 DF,  p-value: < 2.2e-16
  • $\begingroup$ Can you list the levels of your factors, & paste the output from the model (ie, summary(model))? $\endgroup$ Commented Apr 3, 2014 at 19:45
  • $\begingroup$ Thank you for your comment, I updated it with R ouput from the real model. $\endgroup$
    – Pulse
    Commented Apr 3, 2014 at 20:56
  • $\begingroup$ I wonder if you've fit the right model for your question. Shouldn't you have a variable for time1 vs time2? What exactly is your response variable, each patient's Health Outcome after having received both the treatment & placebo in some order? Ie, are you testing the effect of the treatment vs the placebo, or the effect of the treatment & the placebo in order1 vs order2? I wonder if, in effect, you are doing the latter, but it doesn't make sense as a scientific question. $\endgroup$ Commented Apr 4, 2014 at 2:15
  • $\begingroup$ yes you are right, the confusion was created because I tried to simplify the problem, there is no time for measure because this is not before and after measurement but when we examine the outcome we also examine the Health.Status at baseline, in my case it is a specific parameter that would not have changed through time but it reacts with the order of the condition (placebo first or placebo after) with different outcomes, so you are right it is a crossed design $\endgroup$
    – Pulse
    Commented Apr 4, 2014 at 12:41

1 Answer 1


You mention that you could convert to dummy variables, but that is what R does for you automatically. The default is that the baseline value is 0 for all dummy variables and the other factor levels each have their own dummy variable that is 1 for that level and 0 otherwise.

Consider a simple case where we have 2 factors as predictors, factor A has levels No, and Yes with No as the baseline. Factor B has 3 levels, lo, med, hi with lo as the baseline. So that means that a full model would be something like:

$$ y = \beta_0 + \beta_1 A{\rm Yes} + \beta_2 B{\rm med} + \beta_3 B{\rm hi} + \beta_4 A{\rm Yes} B{\rm med} + \beta_5 A{\rm Yes} B{\rm hi} + \varepsilon$$

Where AYes is 0 if A is No and 1 if it is Yes and Bmed is 1 for B med and 0 otherwise and Bhi is 1 for B having value hi and 0 otherwise. Now just plug each of the 6 possible combinations of A and B into the equation and you can start to see the effects of each $\beta$. If A is No and B is lo then all the variables are 0 and only $\beta_0$ remains, so $\beta_0$ is the mean for the No/lo combination. Now if A is Yes and B is lo then we have $\beta_0 + \beta_1$ so $\beta_1$ is the difference between Yes and No when B is lo. Similarly $\beta_2$ is the difference between med and lo when A is NO and $\beta_3$ is the difference between B hi and baseline.

Now the interactions: If we only had an additive model, no interactions, then the mean for the combination A Yes B med would be the baseline plus the effect of A Yes plus the effect of B med which would be $\beta_0 + \beta_1 + \beta_2$, but with the interaction that mean is $\beta_0 +\beta_1+\beta_2+\beta_4$, so the $\beta_4$ term is the difference between the actual cell mean and the mean that would be predicted from an additive model. If $\beta_4=0$ then that means additive works fine, if $\beta_4<0$ then the mean is less than what the additive model predicts and if $\beta_4 > 0$ then we have a higher mean than the additive model predicts. Similar or $\beta_5$.

  • $\begingroup$ Thank you for your response. When you say "Factor B has 3 levels, lo, med, hi with lo as the baseline" do you mean that the low category is automatically converted to 0, so med and hi are compared to the low(baseline)? I thought of the dummy variable because that would be 0=med+high 1=low so I will be able to see the difference in the variation of low compared to the other baseline categories that I do not get if I keep the variable as factor. Am I doing something wrong here? Please let me know $\endgroup$
    – Pulse
    Commented Apr 3, 2014 at 21:08
  • $\begingroup$ @Pulse, The default is as I described, the baseline level will be 0 in all dummies and there will be one dummy variable for each of the other levels. The corresponding variable will be one for that level and 0 otherwise. This lets you compare each level to the baseline level. There are other options for creating the dummy variables and the interpretation will depend on which one is used (but you can still look at which terms will be what and see the comparisons). $\endgroup$
    – Greg Snow
    Commented Apr 3, 2014 at 21:53
  • $\begingroup$ As a basic overview of interactions, this is right of course, but I wonder about the model itself. Would you mind taking a look at the model output edited in & my comment above? Am I missing something? $\endgroup$ Commented Apr 4, 2014 at 2:20
  • $\begingroup$ @gung, your edits are fine. I had a hard time with the original question as well (which was why I simplified it for my example). I like the idea of writing out what the values would be for each possible combination, then comparing to see what the differences are for understanding the interactions. The same process would work if the original poster includes a time variable as well. $\endgroup$
    – Greg Snow
    Commented Apr 4, 2014 at 16:55
  • $\begingroup$ @Greg Snow, sorry for reviving this rather old post. Thanks so much for your clarification about the interpretation of interaction terms. However, I am not sure whether there is a small mistype in your answer or I just did not fully get your explanation. In the last part of your answer you say that β3 "is the difference between the actual cell mean and the mean that would be predicted from an additive model". Did you maybe mean β4? Isn't *β3*=0 in a model A Yes B Med? $\endgroup$ Commented Dec 16, 2016 at 9:31

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.