Nonlinear Least Squares Curve Fitting

Unlike for linear regression, there are no analytical expressions to obtain the set of regression coefficients for a fitting function that is nonlinear in its coefficients. To perform nonlinear regression, we must essentially use trial-and-error to find the set of coefficients that minimize the sum of squares of differences between _ycaic and _yobsd. For data such as in Figure 14-1, we could proceed in the following manner: using reasonable guesses for k\ and k2, calculate [B] at each time data point, then calculate the sum of squares of residuals, SSresiiuais = S([B]ca]c - [B]expt)2. Our goal is to minimize this error-square sum.

We could do this in a true "trial-and-error" fashion, attempting to guess at a better set of k\ and k2 values, then repeating the calculation process to get a new (and hopefully smaller) value for the Residuals- Or we could attempt to be more systematic. Starting with our initial guesses for k\ and k2, we could create a two-dimensional array of starting values that bracket our guesses, as in Figure 14-2. (The initial guesses for k\ and k2 were 0.30 and 0.80, respectively and the array of starting values are 70%, 80%, 90%, 100%, 110%, 120% and 130% of the respective initial estimates.) Then, for each set of k\ and k2 values, we calculate the "SiSresiduais- The k\ and k\ values with the smallest error-square sum {k\ = 0.27,

Nonlinear Curve Fitting Excel

Time

Figure 14-1. A typical plot of the concentration of species B for a system of two consecutive first-order reactions (the reaction scheme A->B->C)

Time

Figure 14-1. A typical plot of the concentration of species B for a system of two consecutive first-order reactions (the reaction scheme A->B->C)

k\ = 0.64 in Figure 14-2) become the new initial estimates and the process is repeated, using smaller bracketing values. Years ago this procedure, called "pit-mapping," was performed on early digital computers.

In essence we are mapping out the error surface, in a sort of topographic way, searching for the minimum. A typical error surface is shown in Figure 14-3 (the logarithm of the Residuals has been plotted to make the minimum in the surface more obvious in the chart).

0.2t

Trial values of k, 0.24 0,27 0.30 0,33

0.36 0.39

0.56

> 0.88 ¡E 096

1.5E-11 2.0E-11

6.SE-12 S.SE-12 6.7E-12 7.2E-13

1.1E-11 1 .OE-12

2.1E-11 6.4E-12

3.5E-11 1.6E-11

5.3E-11 2.9E-11

3.4E-11

1 7E-11

7.8E-12

4.6E-12

6.3E-12

1,2E-11

2.1E-11

5.2E-11

3.3E-11

2.1E-11

1.6E-11

1.5E-11

1.8E-11 2.4E-11

7.2E-11

5.2E-11

3.9E-11

3.1E-11 2.8E-11

2.9E-11 3 3E-11

9.3E-11

7.2E-11

5.7E-11

4.8E-11 4.4E-11

4.3E-11 4.5E-11

1.04

1.1E-10

9.2E-11

7.7E-11

6.7E-11 6.1E-11

5.9E-11 6.0E-11

Figure 14-2. The error-square sums for an array of initial estimates. The minimum Residuals value is in bold.

Figure 14-2. The error-square sums for an array of initial estimates. The minimum Residuals value is in bold.

How Plot Surface Chart Excel 2007
Figure 14-3. An error surface

A more efficient process, the method of steepest descent, starts with a single set of initial estimate values (a point on the error surface), determines the direction of downward curvature of the surface, and progresses down the surface in that direction until the minimum is reached (a modern implementation of this method is called the Marquardt-Levenberg algorithm). Fortunately, Excel provides a tool, the Solver, that can be used to perform this kind of minimization and thus makes nonlinear least-squares curve fitting a simple task.

+4 -4

Responses

Post a comment