Goal: We wish to determine a "closest" function of a given form to the points represented by a list of ordered pairs (the data points).
Preliminaries:We will proceed with an example that finds the best fit to our data points in the form of a 3rd degree polynomial.
Assume that the data is represented in two lists. The first list, L1, contains the x-coordinates (in order) of our data points and the second list, L2, contains the y-coordinates.
Step by step method:
Remark: Other function forms are available at the point where CubicReg is chosen.