# Comparing Least-Squares Fit and Least Absolute Deviations Fit

Comparing Least-Squares Fit and Least Absolute Deviations Fit

The Demonstration compares the least-squares fit method and the least absolute deviations fit method. A straight line is fitted to a set of data points. In the case of the least-squares fit, the straight line is obtained by minimizing the sum of the squares of the residuals, which are the deviations of the data points from the line. In the case of the least absolute deviations fit, the straight line is obtained by minimizing the sum of the absolute values of the residuals. The least absolute deviations fit is a robust fit method, unlike the least-squares fit.

Drag the locators to change the data points and observe the resulting changes of the fitted lines.