Categorical variable interaction compared to individual regressions

We are examining our understanding of interaction terms in categorical variables. We have a three category variable, and the model is:

$$y=\alpha+\beta x+\beta_0x_0+\beta_1x_1+\beta_2xx_0+\beta_3xx_1$$

Here $$x$$ is a continuous (almost) variable, and $$x_i$$ indicates true (1) if the variable belongs to category $$C_i$$, and false (0) otherwise. Note $$C_{0,1,2}$$ are exclusive, such that for each data point $$x_1\neq x_2$$. In this model $$C_2$$ is a reference category.

We compare this to three regressions:

$$y=A_i+B_i x$$

For each of our categories $$C_i$$ - each regression is run for $$\{x|x\in C_i\}$$.

It seemed to us, given the nature of our categories, that we should get exactly:

1. $$A_0=\alpha+\beta_0$$, $$B_0=\beta+\beta_2$$
2. $$A_1=\alpha+\beta_1$$, $$B_1=\beta+\beta_4$$
3. $$A_2=\alpha$$,$$B_2=\beta$$

We are using Stata if that matters, but it seems results are not the same. They are consistent within the uncertainties, but we expected an exact match as for each set $$\{x|x\in C_i\}$$, the interaction model is the same as the corresponding indivdual regression. I have neglected uncertainty terms in the model, but we are not sure they are comparable.

Why do the two differ?

• This notation is unconventional and very confusing, at least to me. – Peter Flom Oct 4 '18 at 18:15
• @PeterFlom No problem - what notation do you prefer? – kabanus Oct 4 '18 at 18:19
• @PeterFlom Do you prefer I use $\beta_0$...$\beta_4$? I am not sure what is confusing you, I just wanted different names for the slope coefficients, and for the individual regression slope coefficients. Do you prefer $m$ and $n$ for the regular regression coefficients? – kabanus Oct 4 '18 at 18:22
• Yes. The usual way of writing it is $y = \beta_0 + \beta_1x_1 + \dots \beta_px_p$ When you have interactions you have to add e.g. $\beta_{p+1}x_1x_2$ Also, all the x's should have subscripts. – Peter Flom Oct 4 '18 at 18:53
• @PeterFlom Just edited - do not hesitate to let me know if this is still unclear. Note there are interaction terms of the form $xx_i$ as well, I thought indexing the slopes with both interacting variables was clearer, but I stand corrected. – kabanus Oct 4 '18 at 18:54