# Fitting data using different optimality criteria

- Author:
- jcfried

**Fitting a Straight Line using L1, Least Squares, Max Distance and Median Distance Criteria**The purpose of this page is to show how different criteria for "best" or "optimal" fit will produce different fitted lines. While this example uses straight line, because i wanted to show the simplest case, the concept is equally applicable to higher order functions (sin, cos, exp, log, etc.) and polynomials.

Notice how the Fit Error changes as you move the LineControl points. Once you have minimized the the Fit Error for any one of the criteria, move the points to see how they affect the Fit Error - it is different for each fit criteria, ie., L1, Least Squares, Max and Median. This is why the different Fit Criteria are applied to solve unique problems. For example the Max Distance criteria is used when fitting polynomials to higher order functions because you want to assure yourself that the polynomial an accurate estimate for the higher order function. Can you imagine special uses for each of the fit criteria?
Thanks to jholcomb, http://www.geogebratube.org/user/profile/id/13125, for his page, http://www.geogebratube.org/material/show/id/85453, which inspired me to construct this page to show the impact of the fit criteria choice.