This old question:
Line closest to a set of points
has been flag has duplicated. However, the related question is not the same, because the answer on the canonical suggest to use a linear regression, a method not valid for the kind of problems the duplicated question is asking about.
In particular:
The canonical question asks "best fit line for the scatter data", slightly ambiguous but that can be understood as "minimal 'y' distance" because the questions refers to the "polyfit" method of matlab. From this point of view, the answers are correct, linear regression
However, the "duplicated" asks for "Find the line whose distance from all the points is minimum ?. By distance I mean the shortest distance between the point and the line". This is, in euclidean spaces (I doubt this question refers to theory of relativity) the square root of sum of 'x' AND 'y' distances.
Thus, they are not the same.
In order to verify previous statement, I asked same question in math stack exchange:
line nearest to a set of points
Math experts confirms that the correct method is not a linear regression and gives the correct method.
Taken into account that the issue is a common one, with hundreds of views, what we could do improve the answers (in the duplicate) and/or remove the "duplicate" flag ?
Notes about the flag of duplicate for this meta question:
- "What can I do if I believe that my question was wrongly marked as a duplicate?" => it is not my quesiton
- “please edit this question to explain how it is different”? => I prefer to not edit a question is not from myself and it is correctly written.
- "ask new question" => I prefer do not leave back a question with incorrect answers.
- "reopen" => no button.
Thus, again, what we can do to solve an issue that can produce errors in some stack overflow readers?