Group Abstract Group Abstract

Message Boards Message Boards

Minimizing distance (not square of distance) of linear fit to data points

GROUPS:
Hi all,

I have a set of  data {x1, y1}, {x2, y2}... 
Is it possible to fit a regression line to this data that minimizes the total distance from the line to my data points? This would be better than Least-Squares in this instance.

Thank you
POSTED BY: Gustav Fredell
Answer
1 year ago
I think I solved the problem myself by using:

FindFit[{dataset}, a + b x, {a, b}, x, NormFunction -> (Norm[#, Infinity] &)]

Thanks for looking.
POSTED BY: Gustav Fredell
Answer
1 year ago
Gustace, I don't think it will take into account the 'horizontal' difference, only the vertical distance.  Calculating the closest distance to a line is a little tricky, but can be done of course. 
POSTED BY: Sander Huisman
Answer
11 months ago
From the wording it appears that you are looking for a "total least squares" result. That can be done using the singular values decomposition.
POSTED BY: Daniel Lichtblau
Answer
11 months ago