How should I implement this interaction between a continuous and categorical predictor? I have a continuous outcome variable. I understand that if I have a binary predictor, and a continuous predictor, and an interaction, then the model looks like this:
$y_{i} = \beta_{0} + \beta_{1}x_{1} + \beta_{2}x_{2} + \beta_{3}x_{1}x_{2} + \varepsilon_{i}$
However, I'm thinking of making the binary predictor a categorical one instead, with three categories. 


*

*What will the model equation look like once I make that change? I understand that I'll need to have two dummy variables, but I can't conceptualize what the interaction will look like under that circumstance. 

*Does it make any difference whether I use 0,1 to code the binary predictor, or some other values like 1,2? This question also applies to the model with the categorical predictor, since in that case I'll have to decide how to code the dummy variables. 

*Prior to the interaction term being in my model I was encouraged to center the continuous predictor. Is centering (still) a good idea now that I have this interaction term?
 A: *

*Assuming your continuous variable is $x_1$ and we expand the binary $x_2$ to include $x_3$ then I suggest using:


$$
y_{i} = \beta_0 + \beta_1x_1 + \beta_2x_2 + \beta_3 x_3 + \beta_4x_1x_2 + \beta_5x_1x_3 + \varepsilon_i
$$
So if the continous variable interacts with the reference category, it will be included in the model by default. If there is an interaction with the second or third category then $\beta_4$ or $\beta_5$ will contain the difference from the reference category. Also, as you're suggesting, it wouldn't make any sense to put an interaction effect between $x_2$ and $x_3$.


*The indicator variables should be coded with 0,1. In this case, if the indicator is not not true, the variable is zero and the corresponding $\beta$ drops out of the equation. This makes for much easier interpretation of the coefficients. 


For example, if your category is the second category ($x_2=1$). Then for a given $x_1$, the interpretation of the category effect is $\beta_0 + \beta_2$. And given $x_2=1$, for every unit increase in $x_1$ there is a $\beta_1 + \beta_4$ increase in your response variable.


*Here is a wonderful post about centering variables. As a short answer, if you were going to center your variable before, then adding interaction effects shouldn't change that. Actually, adding interaction effects is one reason that some people start centering variables to reduce collinearity.

