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.

  • 2
    $\begingroup$ 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. $\endgroup$ – Sobi Dec 10 '15 at 23:19
  • 1
    $\begingroup$ 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. $\endgroup$ – Glen_b Dec 11 '15 at 4:12

You can do regression on two lines if you know which line should apply to each observations.

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

If you don't know group membership, you could try an iterative process whereby you estimate both the lines and the group membership. I have never done that, but it should work if you really have two groups with distinct lines.

| cite | improve this answer | |
  • $\begingroup$ Excellent! I can separate the points using the linear regression line formed from all of the points. Thanks very much, $\endgroup$ – OtagoHarbour Dec 10 '15 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.