# How to test difference between two groups of data in one line

Usually, we can test difference of two groups of data by adding the dummy variable. But my question is, if these two groups of data in the same line, but they concentrate at the different part of this line. Is there any way we can test difference? For example,in group one, our data set is $(x_{1i},y_{1i})$, in group two, our data set is $(x_{2j},y_{2j})$. Both of the groups can regress to the same line $y=a+bx$,where $a$ and $b$ are constant. But in group one $x_{1i}\in(1,3)$, in group two $x_{2j}\in(6,7)$. Thus if we plot group one and group two together, we can see they centralize to different part of line $y=a+bx$. Apparently, dummy variable does not work well here. So is there test can show the difference? Thanks.

• A search for "gap" reveals some promising techniques. – whuber Dec 24 '13 at 18:42
• What are your null and alternative hypotheses? – Glen_b Dec 25 '13 at 8:16
• I am not sure here. I think it should be like ANOVA's null hypothesis,like they have same mean. – user17670 Dec 25 '13 at 18:48