# Interaction effect in linear regression between 1 continuous and a 4-groups factor variable

I have a linear regression model which is:

inhibition ~ age + VO2max + sport_class + VO2max * sport_class


where VO2max is a continuous variable, and sport_class is a 4 group categorical variable (close, open, mixed, none). I am interested in the interaction between these two variables. Having done a stepwise regression I know that there is an interaction that is significant, because this is the best fitting model I have. Inhibition is the continuous independant variable.

When I run this in R, I get the following output:

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)          -0.49382    0.25218  -1.958  0.05220 .
AGE                   0.05542    0.02488   2.228  0.02752 *
VO2                  -0.15798    0.05847  -2.702  0.00776 **
Sport_classmixed     -0.08923    0.09928  -0.899  0.37032
Sport_classnone      -0.19738    0.11671  -1.691  0.09305 .
Sport_classopen      -0.12481    0.06853  -1.821  0.07070 .
VO2:Sport_classmixed  0.31961    0.10076   3.172  0.00186 **
VO2:Sport_classnone   0.10211    0.10572   0.966  0.33578
VO2:Sport_classopen   0.09993    0.07630   1.310  0.19247
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3532 on 139 degrees of freedom
Multiple R-squared:  0.1526,    Adjusted R-squared:  0.1038
F-statistic: 3.129 on 8 and 139 DF,  p-value: 0.002775


What I understand from this output is that VO2:sport_class close was used as the intercept. However, I fail to understand how to interpret the rest of that. What exactly does the estimate of the intercept represent here? Is it the mean value of inhibition when all dependent variables take on 0 ? If yes, since VO2 and inhibition have standardized values, but age does not, can the intercept really be interpreted?

What I can also see is that the VO2:sport_class mixed has a significant p-value. Does that mean that the mixed group has a significantly different slope than the intercept, i.e. the close group?

Because if so, since I want to know if every pair of group differ significantly from oneanother, is it correct to change the intercept group each time and see where I have these significant p-values?

Thanks a lot and sorry for the multiple questions. I find this to be quite confusing and most of the articles about this on the internet talk about a 2-level categorical variable, so it is not applicable here.

Your understanding seems to be pretty much OK, except that you seem to have mixed up the "dependent" and "independent" variable terminology: the predictors on the right side of the formula are called "independent"; the outcome variable on the left is "dependent."

Yes, the intercept is for the situation where all predictors are at 0 or at their reference levels--in whatever form the data were presented to the model. You should take that a step further: the single-predictor coefficient for each of the predictors is also for the situation where the other predictors are at 0 or reference levels. So re-centering or re-leveling interacting predictors can affect the coefficient for a predictor whose coding hasn't been changed. See this page for a worked-through example.

Your interpretation of the VO2:sport_classmixed interaction coefficient is also correct: all of the levels of a multi-level categorical predictor are compared against the value for the reference category in this default coding of categorical predictors.

The best way to examine multiple coefficients pairwise against each other is to use post-modeling software tools like those provided by the R emmeans package. That can do all pairwise comparisons among levels of a predictor, with appropriate correction for multiple comparisons. Re-running the model with different choices of reference level could work (if you also take multiple comparisons into account), but in the long run you will be better off learning how to use those additional, widely applicable tools.

A few thoughts on the modeling

The stepwise regression approach is generally not a good idea. That tends to give a model that fits the current data well but doesn't extend well to new data samples. See this page for extensive discussion. At a minimum, when you use the outcome values to choose the predictors in the model, the p-values are no longer correct as you have violated the assumptions that underlie their calculation.

You also have modeled your continuous predictors as having simple linear associations with outcome. That sometimes works OK as an approximation, but reality is generally more complicated than that. You should check how well that linearity assumption holds for your data. More flexible modeling, e.g. with regression splines, is often better.

Frank Harrell's course notes and book deal extensively with these issues. Chapters 2, 4 and 5 are particularly relevant to what you are trying to do. His rms package provides a system that readily provides both initial modeling and post-modeling analysis.

• Thank you so much for your extensive answer! This responds exactly to my questions. For the IV and DV: you are totally right, I mixed up the words (I was p tired). I am very happy that you talked about changing the reference group so that each group is the reference once -> this is what I did in my work. I have then 6 betas and p-values, for each pair of group, looked at the p-value to say if the slopes of the groups were significantly different from one another. I did not correct for multiple comparison- this is an excellent point and I did not think to do that. 1/2 Nov 29, 2022 at 16:54
• So I did try your suggestion, and with the emmenas package I get the warning that the results might be compromised due to presence of interaction. I saw there was another package to test this, rstatix, which apparently takes into account interaction. It compared each of my groups and results were that no pairwise comparison came out significant (adjusted and not even not-adjusted), so I got confused: how can the stepwise selection keep the interaction but then post-hoc test show no significant interaction difference between any groups? Just wondering from an interpretation pov. 2/2 @EdM Nov 29, 2022 at 16:55
• @krokrono check for a problem in using rstatix. The p = 0.00186 for VO2:Sport_classmixed versus close should maintain statistical significance at a family-wise error rate of 0.05 even with the stringent Bonferroni correction: for 6 comparisons the cutoff is 0.05/6 or 0.0083. There are ways to use emmeans to evaluate contrasts between interactions. The "warning" might just have been a warning; depends on the details of what you did. Having overall "significance" without any pairwise "significance" can happen, however: see this page.
– EdM
Nov 29, 2022 at 20:47