# How to compare the regression coefficients of two independent variables between two groups

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?

$$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.