# Difference between using an interaction term for categorical predictors vs. creating subgroups (linear regression)

In a linear regression with two categorical predictor variables: Let's say the most simple case (e.g. 0= male, 1=female; 0= no vegetarian, 1= vegetarian), so based on those two nominal variable a total of four subgroups could be found in the sampel.

In the regression model we could now include the two main effects + one interaction effect for those two variables.

However, if instead we would make a new variable that identifies the four groups 0=male+no vegetarian 1=female + no vegetarian 2=male + vegetarian 3= female vegetarian

and would put that (in dummified form) in the regression analysis what information would we lose? The ability to see whether overall differences for only gender and only vegetarianism exist (thus the main effects for those variables)? Or are there more disadvantage?

I suggest you read this article that presents an example that highlights presentational (and not quantitative) differences between ANOVA and regression models.

To quote part of the referenced article:

In the ANOVA, the categorical variable is effect coded. This means that the categories are coded with 1’s and -1 so that each category’s mean is compared to the grand mean.

In the regression, the categorical variable is dummy coded**, which means that each category’s intercept is compared to the reference group‘s intercept. Since the intercept is defined as the mean value when all other predictors = 0, and there are no other predictors, the three intercepts are just means.

In both analyses, Job Category has an F=69.192, with a p < .001. Highly significant.

In the ANOVA, we find the means of the three groups are:

Clerical: 85.039

Custodial: 298.111

Manager: 77.619

In the Regression, we find these coefficients:

Intercept: 77.619

Clerical: 7.420

Custodial: 220.492

The intercept is simply the mean of the reference group, Managers. The coefficients for the other two groups are the differences in the mean between the reference group and the other groups.

You’ll notice, for example, that the regression coefficient for Clerical is the difference between the mean for Clerical, 85.039, and the Intercept, or mean for Manager (85.039 – 77.619 = 7.420). The same works for Custodial.

So an ANOVA reports each mean and a p-value that says at least two are significantly different. A regression reports only one mean(as an intercept), and the differences between that one and all other means, but the p-values evaluate those specific comparisons.

It’s all the same model; the same information but presented in different ways. Understand what the model tells you in each way, and you are empowered.

I suggest you try this little exercise with any data set, then add in a second categorical variable, first without, then with an interaction. Go through the means and the re