Least squares fitting of a straight line to a set of data points

Abstract
Least squares fitting of a straight line y=a+bx to a set of data points, when there are errors in the values of both coordinates is reviewed. It is shown that if the errors are equal or unknown, then it is possible to solve the problem by a direct approach, using a quadratic equation, and avoiding iteration. If the errors in both coordinates are unknown, the 'best' line is not invariant under a change of scale: a possible criterion for uniquely determining the best line is suggested. If there are errors in both coordinates, and if each point has its own weighting factors for x and y, a new algorithm is given which involves the iterative solution of a quadratic equation: some remits for this algorithm are presented. A comparative analysis of existing and our methods is presented, using standard data sets. A FORTRAN-77 implementation of our algorithm, suitable for PCs is available.