1
$\begingroup$

First of all, apologies if I am not using the correct terminology to describe the problem. I have a dataset of two variables, which looks like this:

enter image description here

There are clearly two groups of points. I want to separate them so that I can fit a linear regression to each of them.

I can draw a line and decide that everything above it belongs to one group and everything below to the other, but it is a method too crude and the results are not good enough.

Cluster analysis probably can do it, but it seems a bit overkill and I was wondering if there is a simpler way to do it.

A simple data.frame (in R) for testing:

xx <- data.frame(A=c(1,2,3,4,1,1.1,1.2,1.3), B=c(1.1,1.2,1.3,1.4,1,2,3,4))
plot(xx$A, xx$B)
$\endgroup$
3
  • 1
    $\begingroup$ Have you tried optimization? It's likely to be more effective than usual clustering algorithms algorithm although it is not less overkill. $\endgroup$
    – Pere
    Commented Jan 17, 2018 at 13:23
  • $\begingroup$ @Pere not sure what you mean, tbh $\endgroup$
    – point618
    Commented Jan 17, 2018 at 14:11
  • 1
    $\begingroup$ We start by deciding that everything above it belongs to one group and everything below to the other, as you said. Then, we keep changing observations to the other group until a measure of correlation within each group gets an optimal value. However, beware that correlation within each group in your graph doesn't seem to be very large at first glance. $\endgroup$
    – Pere
    Commented Jan 17, 2018 at 14:53

0

Browse other questions tagged or ask your own question.