newton-gauss algorithm iii) calculation the shift parameters vector r (p 0 )dr(p 0 )/dr(p 1 )dr(p 0...

56
Newton-Gauss Algorithm iii) Calculation the shift parameters vector R (p 0 ) dR(p 0 )/ dR(p 1 ) dR(p 0 )/ dR(p 2 ) =- - p 1 p 2 - … - The Jacobian Matrix p 1 = - - p 2 - … -

Post on 19-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Newton-Gauss Algorithmiii) Calculation the shift parameters vector

R (p0) dR(p0)/dR(p1) dR(p0)/dR(p2)= - -p1 p2 - … -

The Jacobian Matrix

p1= - - p2 - … -

Newton-Gauss Algorithmiii) Calculation the shift parameters vector

The Jacobian Matrix

p1

= -

p2

r(p0) J p

r(p0) = - J p

p = - (JTJ)-1 JT r(p0)

p = - J+ r(p0)

Newton-Gauss Algorithmiii) Calculation the shift parameters vector

The Jacobian Matrix

400 420 440 460 480 500 520 540 560 580 600-0.1

-0.08

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

Wavelength (nm)

R(k1,k2) J(k1)

0 2000 4000 6000 8000 10000 12000-0.1

-0.08

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

r(k1,k2)

400 420 440 460 480 500 520 540 560 580 600-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

J(k2)

400 420 440 460 480 500 520 540 560 580 600-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

Vectorised J(k1)

0 2000 4000 6000 8000 10000 12000-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

Vectorised J(k2)

0 2000 4000 6000 8000 10000 12000-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

Newton-Gauss Algorithmiii) Calculation the shift parameters vector

p = p0 + p

= -J(0.3) k1 - J(0.15) k2

0 2000 4000 6000 8000 10000 12000-0.1

-0.08

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

r(0.3,0.15)

0 2000 4000 6000 8000 10000 12000-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

0 2000 4000 6000 8000 10000 12000-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

= - k1 - k2

p = - J+ r(0.3, 0.15)

p = [0.0572 0.0695]

p = [0.3 0.15] + [0.0572 0.0695] = [0.3572 0.2195]

ssq_old = 1.6644 ssq = 0.03346

Newton-Gauss Algorithmiv) Iteration until convergence

Convergence Criterion

Depending on the data, ssq can be very small or very large. Therefore, a convergence criterion analyzing the relative change in ssq has to be applied. The iterations are stopped once the absolute change is less than a preset value, , typically =10-4

ssq old - ssqAbs ( ) ≤

ssq old

Newton-Gauss Algorithm

guess parameters, p=pstart

Calculate residuals, r(p) and sum of squares, ssq

ssq const.?

Calculate Jacobian, J

Calculate shift vector p, and p = p + p

End, display resultsyes

no

Error EstimationThe availability of estimates for the standard deviations of the fitted parameters is a crucial advantage of the Newton-Gauss algorithm.

Hess matrix H = JTJ

The inverted Hessian matrix H-1, is the variance-covariance matrix of the fitted parameters. The diagonal elements contain information on the parameter variances and the off-diagonal elements the covariances.

i = A (di,i)0.5

A = ( )0.5

nt × n – (np + nc × n)

ssq

ng function

Using Newton-Gauss algorithm for multivariate

fitting

r_cons function

Introducing the model for consecutive kinetics to ng

function

kinfit5

Executing the ng function

Initial estimates

?Exactly read the ng.m, r_cons.m and kinfit5.m files and explain them

Rank deficiency and fitting

Second order kinetics

A + B Ck

[A] + [C] = [A]0

[B] + [C] = [B]0

[B]0 = [A]0

[B] + [C] = [A] + [C]

[A] - [B] + ([C] = 0

Rank deficiency in concentration profiles

Linear dependency

A = C E + R

0 2 4 6 8 10 12 14 16 18 200

0.5

1

1.5Concentration Profiles

Time

Con

cent

ratio

n

400 420 440 460 480 500 520 540 560 580 6000

0.5

1

1.5

2

2.5

3Simulated Spectra

Wavelength (nm)

Abs

orba

nce

[A]0 = 1 [B]0 = 1.5 k = 0.3

E = C \ A

400 420 440 460 480 500 520 540 560 580 600-0.5

0

0.5

1

1.5

2

Wavelength (nm)

Calculated pure spectra according to E = C \ A

400 420 440 460 480 500 520 540 560 580 6000

0.5

1

1.5

2

2.5

3

Wavelength (nm)

Abs

orba

nce

Reconstructed data

400 420 440 460 480 500 520 540 560 580 6000

0.5

1

1.5

2

2.5

3Simulated Spectra

Wavelength (nm)

Abs

orba

nce

Measured data

400 420 440 460 480 500 520 540 560 580 600-0.1

-0.08

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

0.08

0.1

Wavelength (nm)

Residuals

?Use ng function for determination of pKa of weak acid HA

The Marquardt modificationGenerally, The Newton-Gauss method converges rapidly, quadratically near the minimum. However, if the initial estimates are poor, the functional approximation by the Taylor series expansion and the linearization of the problem becomes invalid. This can lead to divergence of the ssq and failure of the algorithm.

H = JT Jp = - (H + mp × I)-1 JT r(p0)

The Marquardt parameter (mp) is initially set to zero. If divergence of the ssq occurs, then the mp is introduce (given a value of 1) and increased (multiplication by 10 per iteration) until the ssq begins to converge. Increasing the mp shortens the shift vector and direct it to the direction of steepest descent. Once the ssq convergences the magnitude of the mp is reduced (division by 3 per iteration) and eventually set to zero when the break criterion is reached.

Newton-Gauss method and poor estimates of parameters

Original parameters: k1=0.4 k2=0.2

Estimated parameters: k1=4 k2=2

400 420 440 460 480 500 520 540 560 580 6000

0.2

0.4

0.6

0.8

1

1.2

1.4Simulated Spectra

Wavelength (nm)

Abs

orba

nce

Measured data

Considered model: Consecutive kinetic

Kinfit5.m

Newton-Gauss-Levenberg-Marquardt Algorithmguess parameters, p=pstart initial value for mp

Calculate residuals, r(p) and sum of squares, ssq

ssqold< = > ssq

Calculate Jacobian, J

Calculate shift vector p, and p = p + p

End, display results

=

>

mp=0

mp=0

<

mp ×10 mp / 3

yes

no

Newton-Gauss-Levenberg-Marquardt Algorithm for non-linear curve fitting

nglm.m

kinfit6.m

?Use nglm function for determination of rate constant of a second order kinetics

?Are the calculated error of parameters dependent to initial estimates?