The most common methods I've seen to find a line of best fit are Least Squares regression and median-median. Are there other good ways? Is there a way to minimize the absolute value difference and find a line of best fit that way? Or to find the distance straight to a line instead of the vertical distance to the line? Thoughts?

  • 2
    $\begingroup$ Yes! Many posts on this site. One keyword to search for is L1. $\endgroup$
    – Nick Cox
    Jul 11, 2013 at 0:37
  • $\begingroup$ Could you clarify what you mean by 'median-median' please? $\endgroup$
    – Glen_b
    Jul 11, 2013 at 1:33
  • $\begingroup$ An effective method for more general curve fitting (advocated by John Tukey for exploratory data analysis) that is not as well known as it should be is described and illustrated at stats.stackexchange.com/questions/35711/…. A simpler version of it is to pick two "representative" points near the extremes of a scatterplot and draw the line they determine, provided that line appears to be a reasonable first-order description of the points in the scatterplot. $\endgroup$
    – whuber
    Jul 11, 2013 at 1:36
  • $\begingroup$ @Glen_b, "Median-median" can mean the line through [median($x$), median($y$)] with slope = median( $y_i / x_i$ ). This is robust and takes only a few lines of code, but is afaik hard to analyze theoretically. $\endgroup$
    – denis
    Jul 10, 2015 at 10:15
  • $\begingroup$ @denis yes, thanks for that one -- there are a few things "median-median" could mean. My guess is the OP means something else, though it's hard to be sure. [If you know of a book or paper that discusses the one you mention, I'd be interested to take a look.] $\endgroup$
    – Glen_b
    Jul 10, 2015 at 11:00

1 Answer 1


Minimizing the sum of absolute differences is quite common, as Nick Cox suggests, it's often called L1 regression or Least absolute deviations regression; it's also a specific case of quantile regression and many posts here relate to it.



The orthogonal distance (what I assume you mean by "straight-line distance") would correspond to a particular case of Deming regressing, itself a particular case of the total least squares line, called orthogonal regression, which will give the line of the first principal component.




There are many, many other lines that might be fitted; a couple of examples include Theil-Sen regression or more generally, robust regression, which includes many different techniques.

Some discussion of robust regression (including some comparison of Theil-Sen and L1 regression) is here.

There's some interesting discussion relating correlation measures to straight-line fits here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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