1
$\begingroup$

I have a multiple linear regression model:

$$y= \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \beta_3 x_3 + \beta_4 x_4 + \beta_5 x_5$$

where $x_1$ is a continuous variable and $x_2$, $x_3$, $x_4$ and $x_5$ are all dummy variables come from a 5 levels categorical variable. Now I found out the continuous variable and the categorical variable are dependent, so I have to add the interaction term into my model.

In this case, how many terms do I have to add? In other words, how many betas do I have to add to my model?

I don't think it is simply 4 or 5 betas, will it be something like 15 by combination?

$\endgroup$

2 Answers 2

2
$\begingroup$

A way to think about this is suppose you had a quadratic effect of a continuous predictor, requiring 2 coefficients. Interacting that predictor with the 5-level categorical variable means that you have 5 quadratic curves so this is 10 parameters. Rephrasing the model in the usual way you'd have 2 main effect parameters for the quadratic relationship for the reference category and 8 interaction terms.

$\endgroup$
1
$\begingroup$

Think about what the interaction would mean: it says that the slope of the continuous variable ($x_1$) depends on the level of the categorical variable (although you can interpret the model also as the mean-differences between the levels of the categorical variable changing according to $x_1$). As you have 5 "groups", you need only 4 interaction terms. Your regression then would look like

$y = b_0 + b_1x_1 + b_2x_2 + b_3x_3 + b_4x_4+b_5x_5 + b_{12}x_1x_2 + b_{13}x_1x_3 + b_{14}x_1x_4 + b_{15}x_1x_5 + \epsilon.$

Now, for "group" 1 (all dummies are equal to zero) you have

$E[y|x_1, x_2=1,x_3=0,x_4=0,x_5=0] = b_0 + b_1 x_1$

for "group" 2 (all dummies are equal to zero except $x_2$), you have

$E[y|x_1, x_2=0,x_3=1,x_4=0,x_5=0]= (b_0+b_2) + (b_1+b_{12})x_1$,

for "group" 3 (all dummies are equal to zero except $x_3$), you have

$E[y|x_1, x_2=0,x_3=1,x_4=0,x_5=0]= (b_0+b_3) + (b_1+b_{13})x_1$,

and so on...

$\endgroup$
2
  • $\begingroup$ I was just wondering should we consider the interaction between dummy variables itself. Say the term x1x2x3? Cause I have tried 4 and 5, and it doesn’t seem to work:( thanks! $\endgroup$
    – Roya Yu
    Commented Feb 2, 2018 at 19:12
  • $\begingroup$ Yes. It can't work because you'll have no data point that belongs simultaneously to level 4 and level 5. Recall that you have constructed the dummy variables from a single categorical variable. So each observation belongs to one and only one level. $\endgroup$
    – baruuum
    Commented Feb 4, 2018 at 1:03

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.