Up: Outline

# Residuals

Given a set of N data points (x0, y0), (x1, y1), ..., (xN, yN), and a function F defined on the interval [x0, xN], we can get an idea of how "far away" F is from the data set by computing the residuals
ri = yi - F(xi).

### Residuals (lengths of the blue line segments) between a function F and a set of data points.

The residuals indicate the vertical distance from our function at xi to our data point. If residuals are large, then our function is not very close to the data points. To get a global view of how close F is to the set of all data points, we might try to add up the residuals. Unfortunately, however, some residuals that are positive might cancel with others that are negative, and so we might find that the sum of the residuals is nearly zero, even though our function does not pass close to any of the data points.

A more useful estimate is to compute the sum of the squares of the residuals. The square of a residual is always positive, so if the sum of the squares of the residuals is a small number, then our function passes close to many of the data points. This is the method used by the well-known statistical method of linear regression, also known as the method of "least-squares fit".