# Interaction between continuous variable and categorical variable (2+ categories)

I'm about to do my analysis of my Master's thesis, but I have a question. I want to check whether media effects on political trust are different between natives and immigrants. These are my variables:

• Dependent: political trust (a continuous variable, ranging from 0 to 70 (I summed up seven items on an 11-point scale, after doing factor analysis)).
• Independent variables:
• TV news: the amount of news people watch on television (11-point scale ranging from 0 (never) to 10 (more than 3,5 hours)).
• TV entertainment: the same for entertainment content.
• Newspaper news
• Newspaper entertainment
• Radio news
• Radio entertainment

I created five dummy variables for migrant status: a respondent can either belong to the native group, be a first generation Western immigrant, second generation western immigrant, first generation non-Western immigrant and a second generation non-Western immigrant. This means I have to include four dummies in the analysis.

Now I want to check whether the effect of, for example, television news on political trust is different between natives or immigrants. How do I have to make interactions between this continuous variable (TV news consumption) and the categorical variable (migrant status, the five dummies). How many interactions do I have to make? Vnews*the 5 migrant status dummies?

• The basic question is: how do I construct interaction effects between a continuous variable and a categorical variable with 5 categories? Commented Aug 4, 2014 at 13:16

## 1 Answer

In short, if you have translated the categorical variables to binary dummy variables, you can simply multiply your continuous variable by the dummy variable and treat this product (which is the interaction of the two variables, the continuous and the dummy) as a new predictor.

In details, you have to take two steps: defining binary dummy variables, adding the effect to the model.

That is to say, for the first step, define four binary dummies (for instance, $FirstGenWest$, $SecondGenWest$, $FirstGenNonWest$, $SecondGenNonWest$). Each individual can score one for at most one of them. The native individuals will be zero on all of them, and you can understand them as the control group. If interpreting the natives as control is hard to grasp, just introduce another binary dummy variable $Native$ (so you'll have 4+1=5 dummies). I assume you make the parsimonious choice and go with four dummies. So, the model including the TV news consumption ($TVNews$) you and these four dummies will have 1 ($TVNews$) + 4 (dummies) predictors.

If you want to have only two groups (natives vs. non-natives) you can simply introduce one dummy variable ($NonNatives$) and and translate the previous dummies into this new variable and then forget about the previous dummies. Again, the natives will be the control group, and again, if you prefer, dedicate a new dummy for $Natives$

For the second step, you treat the dummies as if they were continuous variables. Hence, to have the effect, simply multiply the predictor by your dummies and treat it like a new predictor.

In the same case, your model will have 1+4+4=9 predictors in totall: $TVNews$, $FirstGenWest$, $SecondGenWest$, $FirstGenNonWest$, $SecondGenNonWest$ (dummies) , $TVNews*FirstGenWest$, $TVNews*SecondGenWest$, $TVNews*FirstGenNonWest$, and $TVNews*SecondGenNonWest$ (interaction of each dummy with $TVNews$).

P.S. I found two similar answered questions. You can find a more general explanation here and in more details (with R code) here.