next home previous table of contents chap 3 toc

3.3.2 Fitting Data With a Linear Function

First we will consider fitting data with a linear function f. Using the general form of a linear equation, we can write

f(x) = mx + b,

where m is the slope of the line and b is the y-intercept. We don't yet know the values of m and b; they are the values that will be determined using the given data. Let (xi,yi) be a given data point, and assume that f has been chosen to model the data. Then the model will predict the point (xi,f(xi)). The error, or residual, at xi is given by

|mxi + b - yi|.

We have already decided that we will not require our function to pass through all the data points, so we expect that there will be some error at the data points. We would like to choose the coefficients for the linear function in such a way that the error is small.

next home previous go to the top table of contents chap 3 toc

Send comments on material to Cynthia Lanius

These pages are maintained by Hilena Vargas (hvargas@rice.edu)
Updated: February 28, 2001

 Copyright © 2001 Richard Tapia and Cynthia Lanius