# Same estimate of least squares regression equation

This was one of the question in my test which I was not able to attempt.

Question:

Let $\left\{ \left. \left(x_{i,1}, x_{i,2}, \ldots, x_{i,d}, y_i\right) \; \right\rvert \; i = 1, \ldots, n \right\}$ be a multivariate sample and furthermore assume each observation belongs to one of $k$ possible categories.

Consider the two following methods to model the data:
i) Fit a separate linear model to the data in each category using the LSEs.
ii) Fit an interaction model to all the data using the LSEs.

Show that for a fixed category, methods (i) and (ii) will yield the same estimate of the least squares regression equation for that category.

If anyone could provide some guidelines on how to solve this, it will be appreciated.

Thanks.

• Are you comfortable with matrices and matrix notation? – Matthew Gunn Dec 17 '15 at 8:50

Without loss of generality, assume that there is only two groups such that K=2 and one explanatory variable.

The model is thus $y_i=\alpha+\beta_x*X_i+u_i$ where you create a dummy variable $D$ such that you code the group 1 or group 2.

Fully interacting the model gives: $y_i=\alpha+\beta_D*D+\beta_x*X_i+\beta_{Dx}*D*X_i$ (1)

as compared to the models:

$(y_i|D=0)=\gamma+\delta_x*X_i+u_i$ if $D=0$ (2)

and $(y_i|D=1)=\kappa+\phi_x*X_i+u_i$ if $D=1$. (3)

Now, considering the three models, we see that $\alpha=\gamma$ when $D=0$ and that $\alpha+\beta_D=\kappa$ when $D=1$ Same goes for the slopes. Taking marginal effects would yield: $\beta_x+\beta_{Dx}*D$ in model (1), $\delta_x$ in model (2) and $\phi_x$ in model (3)

If $D=0$ in the fully interacted model, the slope coefficient is $\beta_x$ and if $D=1$, the slope is $\beta_x+\beta_{Dx}$. We then have the equalities $\beta_x=\delta_x$ and $\beta_x+\beta_{Dx}=\phi_x$

The two models are thus equivalent.

Output from Stata: the dependent is the log of the wage, the explanatory is the number of years of study and stage=1 if the person has made an internship (made up data)   You can make the sums yourself easily. 