Background ||| Techie-Stuff ||| Instructions ||| Syntax Rules ||| Model Library
Simple linear curve fitting deals with functions that are linear in the parameters, even though they may be nonlinear in the variables. For example, a parabola y=a+b*x+c*x*x is a nonlinear function of x (because of the x-squared term), but fitting a parabola to a set of data is a relatively simple linear curve-fitting problem because the parameters enter into the formula as simple multipliers of terms that are added together. Another example of a linear curve-fitting problem is y= a+b*Log(x)+c/x; the terms involve nonlinear functions of the independent variable x, but the parameters enter into the formula in a simple, linear way.
Unfortunately, many functions that arise in real world situations are nonlinear in the parameters, like the curve for exponential decay y=a*Exp(-b*x), where b is "wrapped up" inside the exponential function. Some nonlinear functions can be linearized by transforming the independent and/or dependent variables. The exponential decay curve, for example, can be linearized by taking logarithms: Log(y)=a'-b*x . The a' parameter in this new equation is the logarithm of a in the original equation,so once a' has been determined by a simple linear curve-fit, we can just take its antilog to get a.
But we often encounter functions that cannot be linearized by any such tricks, a simple example being exponential decay that levels off to some unknown value: y=a*Exp(-b*x)+c. Applying a logarithmic transformation in this case produces Log(y-c)=a'-b*x. This linearizes b, but now c appears inside the logarithm; either way, we're stuck with an intrinsically nonlinear parameter estimation problem, which is considerably more difficult than linear curve-fitting. That's the situation this web page was designed to handle.
For a more in-depth treatment of this topic, check out Dr. Harvey Motulsky's new web site: Curvefit.com -- a complete guide to nonlinear regression. Most of the information here is excerpted from Analyzing Data with GraphPad Prism, a book that accompanies the program GraphPad Prism. You can download this book as a pdf file.
Techie-stuff (for those who might be interested):
Unequal weighting is accomplished by specifying the standard error associated with the y variable. Constant errors, proportional errors, or Poisson (square root) errors can be specified by a menu, and don't have to be entered with the data. Standard errors can also be entered along with the x and y variables. Finally, replicate y measurements can be entered; the program will compute the average and standard error of the mean.
Also available are a number of simple variable transformations (log, reciprocal, square root), which might simplify the function to be fitted and improve the convergence, stability and precision of the iterative algorithm. If a transformation is applied to the y variable, the program will adjust the weights appropriately.
The page also fits least-absolute-value curves by applying an iterative reweighting scheme by which each point is given a standard error equal to the distance of that point from the fitted curve. An option allows differential weighting of above-curve points vs. below-curve points to achieve a specified split of points above and below the curve (a percentile curve fit).
No special goal-seeking methods, precision-preserving techniques (such as pivoting), convergence-acceleration, or iteration-stabilizing techniques (other than a simple, user-specified fractional adjustment), are used. This method may not succeed with extremely ill-conditioned systems, but it should work with most practical problems that arise in real-world situations.
The current implementation is limited to eight parameters and eight independent variables. These arbitrary limits could be increased without much trouble if necessary. I don't know what the maximum number of data points is; it's probably dependent on your browser's maximum string size, since the contents of the Data and Results windows are treated as large text strings. I've used this page to fit 500-point datasets with no problems.
The fields below are pre-loaded with a simple example: the
a cup of water as it cools from boiling hot to room temperature over
course of an hour, being fit to Newton's Law of Cooling:
Temp = ( T0 - Troom ) * Exp( - k * Time ) + Troom