Home | Mathematics |     Share This Page

Polynomial Regression Data Fit (Java version)

P. LutusMessage Page

Copyright © 2012, P. Lutus

This is PolySolve Version 3.7 (09-22-2012)

Background | The Applet | Notes | Version History | References

Note: This program has been superseded by a JavaScript version
that functions bettter and runs on more systems.

For a given data set of x,y pairs, a polynomial regression of this kind can be generated:

$ \displaystyle f(x) = c_0 + c_1 \, x + c_2 \, x^2 + c_3 \, x^3 ... $

In which $c_0,c_1,c_2 \, ...$ represent coefficients created by a mathematical procedure described in detail here.

In this regression method, the choice of degree and the evaluation of the fit's quality depend on judgments that are left up to the user. It is well known about this class of regression method that an effort to squeeze more correlation out of the algorithm than the data can support will sometimes produce an out-of-control function that, although it matches the data points, wanders wherever it pleases between those points. Therefore, a "good" (approaching 1.0) correlation coefficient is not enough to assure a well-behaved or meaningful function. Decisions about a result's appropriateness is more a matter of judgment than mathematics.

A "perfect" fit (one in which all the data points are matched) can be gotten by setting the degree of the regression to the number of data pairs minus one. But, depending on the nature of the data set, this can also sometimes produce the pathological result described above in which the function wanders freely between data points in order to match the data exactly.

For those seeking a standard two-element linear regression, select polynomial degree 1 below, and for the standard form —

$ \displaystyle f(x) = mx + b$

— b corresponds to be the first parameter listed in the results window below, and m to the second.

This regression is provided by the Java applet below. To enter new data, type data pairs into the upper window (or paste from the system clipboard by pressing Ctrl+V), then press "Solve." To change the degree of the equation, press one of the provided arrow buttons.

The Applet

Data Entry Area: Select: Ctrl+A | Copy: Ctrl+C | Paste: Ctrl+V

   It appears that you don't have Java installed. Click here to get your free copy.

Results Area:Select: Ctrl+A | Copy: Ctrl+C | Paste: Ctrl+V

  • To paste data from the system clipboard into the upper "Data Entry" window, click the window, press Ctrl+A, then press Ctrl+V.
  • To copy data from the lower "Results Area" window, click the window, press Ctrl+A, then press Ctrl+C.
  • To download a copy of this program for desktop use, click here: PolySolve.jar (30 KB).
  • To run the downloaded JAR file, open a command prompt and type:

    java -jar PolySolve.jar

  • If the above command doesn't work, you may need to download a Java runtime engine (it's free). Click here to get your Java runtime engine.
  • For a source archive / Netbeans project, click here: PolySolve.tar.bz2 (14 KB).
  • PolySolve is © copyright 2012, P. Lutus and is released under the GPL.
Version History
  • 09-22-2012 Version 3.7. Fixed a bug in the table generator that poduced incorrect percentage values.
  • 09-05-2012 Version 3.6. Increased the number of output formats and added a table generator, to support another project that uses this program.
  • 09-03-2012 Version 3.5. Updated code to conform to recent changes in Java.
  • 02-27-2011 Version 3.4. Rewrote the input/output scheme to address the fact that one can no longer copy or paste directly into a Java applet.
  • 12-01-2009 Version 3.3. Further optimized matrix processing code.
  • 11-13-2009 Version 3.2. Changed computation order to read each datum only once.
  • 10-25-2009 Version 3.1. Refactored, optimized.
  • 10-20-2009 Version 3.0. Brought up-to-date from a prior, much less efficient form.

Home | Mathematics |     Share This Page