# Linear regression on set of points with two lines

I have a set of points, in 2D space, where there are two tight (with minimal scatter) lines, with different slope and offset. There are also randomly scattered points that do not fall onto either line.

It appears that simple linear regression works with only one line. Another thought that I had was to do a Hough transform on the points if there is not a linear regression technique to handle two lines within the same set of points.

• You can also consider a mixture model: assign each point to one mixture component and then model each mixture component with a linear regression model. – Sobi Dec 10 '15 at 23:19
• There are a number of posts already on site that discuss regression mixture models (e.g. here's one). With some judicious searches, you might find there's a good answer already. – Glen_b -Reinstate Monica Dec 11 '15 at 4:12

$$y_i = \beta_0 + \beta_1G_i + \beta_2 x_i$$
This fits two parallel lines, where $G_i$ is an indicator of group membership. If you don't want parallelism, you add another term:
$$y_i = \beta_0 + \beta_1G_i + (\beta_2 + \beta_3 G_i) x_i$$