## B3 Models That Are Not Closed Form Equations

In many cases, models for experimental data cannot be expressed as closed form equations; that is, no expression of the form y = F(x) can be found. The model may need to be solved for y by approximate numerical methods.

The lack of a closed form model need not be an obstacle to applying nonlinear regression, provided that a program is used that does not require closed form derivatives. A numerical model that computes y;(calc) at the required values of Xj by any method can be used as the model subroutine of the regression program.

A relatively simple example is a model of the form F(x, y ) = 0. An iterative approximation to find roots of such equations is the Newton-Raphson procedure [4], This method can be used to solve polynomial equations such as y3 + axy2 + a2y + a3 = 0. (3.7)

The equation to be solved is of the form F(y) = 0. If an initial guess of the root is the value yk, then the Newton-Raphson method holds that a better approximation, yk+1, for the root is given by yk+l=yk-F(yk)/D(yk) (3.8)

where F( yk) is the value of the function at yk and D(yk) is the first derivative of the function evaluated at yk.

The method works well for polynomials if a reasonably good initial estimate of the root is provided. Equation (3.8) is then used repeatedly until convergence to a preset limit (Iim) is reached. A typical convergence criterion is that the fractional change between successive values of yk is smaller than the convergence limit, lim:

where lim may be set at 0.0001 or smaller, as desired. Given a good initial estimate, convergence is rapid for well-conditioned applications and is often reached in a few cycles. Equations other than polynomials can also be solved by the Newton-Raphson approach.

A polynomial model describes the data in steady state voltammetry when the electrode reaction follows the stepwise pathway below:

For this so-called EC2 electrode reaction pathway (electron transfer followed by second-order chemical step), the product of the electron transfer at the electrode (eq. (3.10)) reacts with another of its own kind to form a dimer (eq. (3.11)). The steady state voltammogram is described by y + [exp(x - x0)S] y2/3 - y0 = 0 (3.12)

where y is the current at potential x; x0 is the standard potential for the O/R redox couple, S = F/RT (F, T and R have their usual electrochemical meanings), and y0 is the limiting current. In fitting this model to a set of

y, x data pairs, the Newton-Raphson method can be used to solve the model each time a computed value of y is needed by the nonlinear regression program.

This procedure will require the expressions as well as eqs. (3.8) and (3.9). A procedure to compute the y;(calc) values for this model in BASIC is given in the subroutine shown in Box 3.2.

The preceding is an example of a model that must be solved by numerical methods. A variety of numerical simulation methods may be used to provide models. For example, simulation models for electrochemical experiments have been successfully combined with nonlinear regression analysis [1]. In such cases, the simulation becomes the subroutine to compute the desired response.

The subroutine in Box 3.2 comes into play after the y and x data are read into the regression program. When the program requires values of

SUBROUTINE 3.2. BASIC CODE FOR NEWTON-RAPHSON METHOD

20 MM = (an expression to provide initial guess for each xj)

25 REM subroutine called by main program for each 1% data point from 1 to

30 F(I%) = MM + exp((X(I%)-B(0))*B(l))MMA(2/3) - B(2) 40 D(I%) = 1 + (2/3)*exp((X(I%)-B(0))*B(l))MMA(-l/3) 50 Y9(I%) = MM - F(I%)/D(I%)

60 REM test for convergence; iterations stopped if >50 cycles 70 IF ABS((Y9(I%) - MM)/Y9(I%))<=LIM THEN 120 80 MM = Y9(I%)

90 JJ%(I%) = JJ%(I%) + 1: IF JJ%(I%) > 50 PRINT "UPPER LIMIT OF

CONVERGENCE EXCEEDED": GO TO 120 100 GOTO 30 120 YCALC(I%) = Y9(I%) After line 120, return control to the main nonlinear regression program, to begin another estimate of YCALC(I%+1) or to continue the next cycle in the regression analysis if the end of the data set has been reached.___

F{ y> ,Xj)= y J + [exp( x, - x0)S ] yjn - y0 and D(yj,xj) = 1 + (2/3) exp[(*y - xt))S]yt 1/3

Box 3.2 BASIC code for Newton-Raphson method.

YCALC(I%), it must be directed to line 10 to obtain the Newton-Raphson solutions. The line by line description of the subroutine is as follows:

Line 10 sets a value for the tolerance limit LIM and sets a counter to zero.

Line 20 computes initial estimate of YCALC(I%). This can often be obtained as a multiple or fraction of the experimental y value.

Line 30 is the actual regression model (eq. (3.13)). It can be changed by the user.

Line 40 is the first derivative (eq. (3.14)) of the regression model, which requires modification if the model changes.

Line 50 computes Newton-Raphson estimate of the next best YCALC(I%).

Line 70 tests to see if the desired tolerance limit has been reached, and if so directs the program to compute final YCALC(I%) in line 120.

Line 80 defines the next "best guess" for YCALC(I%).

Line 90 increases the counter by 1, and tests to see if the maximum number of iterations has been exceeded. If so, the final estimate of YCALC(I%) will be made (line 120).

Line 100 directs program to begin the next Newton-Raphson cycle if the counter is smaller than the maximum number of cycles allowed.

Line 120 computes final YCALC(I%).