PolynomialRegression Package

Mathematica Packages
Bruce Torrence Homepage

data = Table[{k, k^3 - k - 20 + Random[]}, {k, 10}]; CubicFit[data]
y = -19.1431 - 1.35605 x + 0.090536 x^2 + 0.993791 x^3

- Graphics -

- Graphics -

Synopsis

This package provides commands to fit polynomials to bivariate data, and display the resulting function superimposed on the data. A plot of the residuals is also provided. It is intended as an instructional aid.

Commands

The following commands are provided in this package:

QuadraticFit[xdata, ydata] gives the equation of the least-squares quadratic function for the data, a scatterplot of the data with the quadratic function superimposed, and a residual plot. It will take any options that ListPlot takes. QuadraticFit[data], where data is a list of coordinate pairs {{x1,y1},{x2,y2},...}, will give the same result.

CubicFit[xdata, ydata] gives the equation of the least-squares cubic function for the data, a scatterplot of the data with the cubic function superimposed, and a residual plot. It will take any options that ListPlot takes. CubticFit[data], where data is a list of coordinate pairs {{x1,y1},{x2,y2},...}, will give the same result.

QuarticFit[xdata, ydata] gives the equation of the least-squares quartic function for the data, a scatterplot of the data with the quartic function superimposed, and a residual plot. It will take any options that ListPlot takes. QuarticFit[data], where data is a list of coordinate pairs {{x1,y1},{x2,y2},...}, will give the same result.

PolynomialFit[xdata, ydata, n] gives the equation of the least-squares degree n polynomial for the data, a scatterplot of the data with the polynomial superimposed, and a residual plot. It will take any options that ListPlot takes. PolynomialFit[data,n], where data is a list of coordinate pairs {{x1,y1},{x2,y2},...}, will give the same result.

Note that there is a LinearFit command in the BasicRegression Package.


Last Updated: June 20, 2002