I found this question linked on another question. I actually did academic research on this kind of problem. Please check my answer http://stats.stackexchange.com/questions/34237/least-square-root-fitting-a-fitting-method-with-multiple-minima/34285#34285 for more details. whuber's Hough transform based approach is a very good solution for simple scenarios as the one you gave. I worked on scenarios with more complex data, such as this: ![data association problem - candy data set][1] My co-authors and I denoted this a "data association" problem. When you try to solve it, the main problem is typically combinatorial due to the exponential amount of possible data combinations. We have a publication "[Overlapping Mixtures of Gaussian Processes for the data association problem][2]" where we approached the general problem of N curves with an iterative technique, giving very good results. You can find Matlab code linked in the paper (sorry, no R nor Python). I have another paper where we relaxed the problem to obtain a convex optimization problem, but it has not been accepted for publication yet. It is specific for 2 curves, so it would work perfectly on your data. Let me know if you are interested. [1]: https://i.sstatic.net/zQjkN.png [2]: http://www.squobble.com/academic/doc/lazarogredilla2012_omgp.pdf