1

I want to test whether the coefficients of two independent variables ($x_1, x_2$) are different in two groups.

I know I can use a dummy variable $d$ which equals $1$ for group $1$ and equals $0$ for group $2$, and then get the regression model $y=β_0+β_1d+β_2x+β_3xd$ to see whether $β_3$ significantly differs from $0$. But in this model, there is only one independent variable $x$. How can I use a dummy variable when I have more than one independent variable?

gung - Reinstate Monica
  • 132,789
  • 81
  • 357
  • 650
moon star
  • 35
  • 4

1 Answers1

0

You just need two interaction terms. Your model would be:
$$ y=β_0+β_1d+β_2x_1+β_3x_2 + \beta_4x_1d + \beta_5x_2d $$ From there, if you wanted to test them individually, you would just inspect the $t$-test that came standardly with your output for each of the two interactions. If you wanted to test them both together, you would drop the two interaction terms and fit a nested model. Then you would perform a nested model test.

gung - Reinstate Monica
  • 132,789
  • 81
  • 357
  • 650
  • Thanks so much. And may I know more about the nested model test? Is it to test whether the model B: y=β0+β1d+β2x1+β3x2+β4x1d+β5x2d is better than model A: y=β0+β2x1+β3x2? – moon star Feb 20 '18 at 19:27
  • @moonstar, yes, you take your "A" as the null, & see if you should reject that in favor of "B". If the test is significant, there is information in those 2 interaction terms (somewhere). Regarding nested model tests, it may help to read my answer here: [esting for moderation with continuous vs. categorical moderators](https://stats.stackexchange.com/a/33090/7290). – gung - Reinstate Monica Feb 20 '18 at 19:37