13
Tutorials 1. Confidence Intervals in parameter estimation. Example. Consider the speed of ants as a function of temperature. We want to see if this can be modelled using Arrhenius equation Data T °C Speed (cm/s) T (K) 1/T ln(speed) 10 0.5 283 0.003534 -0.69 20 2 293 0.003413 0.69 30 3.4 303 0.0033 1.22 38 6.5 311 0.003215 1.87 Solution: Let us take (a) first two data points, (b) first three data points and (c) all four data points. When we fit the data to 0 , writte ln( ) n as = + ln( ) intercept slop 1 Y e k X T E p R s eed we get intercept and slope. This can be obtained using software. e.g. Excel or Matlab. In Matlab , use mdl = fitlm(x,y). We can also get the upper and lower bounds (95% confidence interval) using coefCI(mdl) in Matlab. You can get same information in Excel, if you use Data Analysis pack (a) With two points we get Parameter Value Lower Bound Upper bound Intercept 39.744 -+Slope -11442.8 -+R-square 1 (b) With three points, we get Parameter Value Lower Bound Upper bound Intercept 28.508 -56 1113 Slope -8227.29 -32902 16447 R-square 0.947 (c) With all the four points, we get Parameter Value Lower Bound Upper bound Intercept 26.84 12 41 Slope -7745.74 -12050 -3441 R-square 0.967

Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

Tutorials

1. Confidence Intervals in parameter estimation. Example.

Consider the speed of ants as a function of temperature. We want to see if this can be modelled

using Arrhenius equation

Data

T °C Speed (cm/s) T (K) 1/T ln(speed)

10 0.5 283 0.003534 -0.69

20 2 293 0.003413 0.69

30 3.4 303 0.0033 1.22

38 6.5 311 0.003215 1.87

Solution:

Let us take (a) first two data points, (b) first three data points and (c) all four data points.

When we fit the data to 0 , writteln( ) n as = + ln( ) intercept slop1

Y ek XT

Ep

Rs eed

we get intercept and slope. This can be obtained using software. e.g. Excel or Matlab.

In Matlab , use mdl = fitlm(x,y). We can also get the upper and lower bounds (95% confidence

interval) using coefCI(mdl) in Matlab. You can get same information in Excel, if you use Data

Analysis pack

(a) With two points we get

Parameter Value Lower Bound Upper bound

Intercept 39.744 -∞ +∞

Slope -11442.8 -∞ +∞

R-square 1

(b) With three points, we get

Parameter Value Lower Bound Upper bound

Intercept 28.508 -56 1113

Slope -8227.29 -32902 16447

R-square 0.947

(c) With all the four points, we get

Parameter Value Lower Bound Upper bound

Intercept 26.84 12 41

Slope -7745.74 -12050 -3441

R-square 0.967

Page 2: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

2. Extraction of kinetics from Data, Rate expression from mechanism.

Ruthenium, a noble metal like platinum, is considered as a candidate for barrier metal in copper

wiring used in microelectronic chips. During the chip fabrication process, controlled removal of

Ru is needed. Ru was kept in stirred solutions of various concentrations of KBrO3 and the

concentration of Ru in the solution was measured using ICP-OES. The results are given below.

KBrO3 Concentration

(mM) 0.1 0.25 0.75 2.5 7.5 25 100

Ru Dissolution Rate

(nm/h) 3.3 5.1 6.5 10.5 23.4 41.1 89.1

The activity of Ru surface is unity. In any experiment, KBrO3 concentration does not

decrease significantly with Ru dissolution, the quantity of Ru and KBrO3 reacted is

extremely small, and hence can be considered a constant.

a. Using differential method, determine the order of the reaction.

b. Write the rate expression for the formation of RuO4, using the following mechanism 1k *

3 3Ru + KBrO [Ru-KBrO -complex]

2k**

32 [Ru-KBrO -complex] insoluble Ru-oxide

3k**

3 4[Ru-KBrO -complex] RuO (soluble)

Solution:

Ruthenum etch rate vs concentration of KBrO3 is given below. Note that the scale is log-log

**

3Pseudo steady state approximation for [Ru-KBrO -complex]

0.1

1

10

0.1 1 10 100

KBrO3 Concentration (mM)

Ru

etc

h r

ate

(n

m m

in-1

)

Ru etch rate(nm min-1

) = 0.44 [KBrO3(mM)]0.47

Page 3: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

2

1 3 2 3

d complex =k KBrO -k complex complex 0

dtk , where the square brackets are used

to indicate the concentration. This is written as 2ax bx c where a = k2, b = k3, c = -k1[KBrO3].

2

3 3 2 1 3

2

-k k 4 k KBrOcomplex =

2

k

k

since the other solution is negative and is physically

meaningless. If k3 << k1×k2, then, rate of formation of RuO4 will then be given by rate =

3 3

4complex KBrO

d RuOk

dt

Page 4: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

3. Analysis of batch reactor data to extract kinetics.

The following data are obtained for a reaction occurring in a constant volume constant

temperature batch reactor.

t (min) 0 3 6 9 12 15 18 21 24 27 30 33 36

C(mol/lit) 20.344 19.283 19.25 18.002 17.643 16.656 16.328 15.544 14.832 14.584 13.891 13.57 12.686

A. Using integral method, determine the rate constant and the R-square value assuming (a)

zero order, (b) first order and (c) second order reactions. Plot the graphs (using excel or

some other software) and attach the graphs with your answers.

B. The data are actually a simulated set, for a zero order reaction, with initial concentration of

20 mol/lit, and a rate constant of 0.2 min-1. A random ‘noise’, with a maximum of 5% of

the concentration value was introduced to simulate ‘experimental and measurement errors’.

With this information, explain why the first and second order equations also seem to fit

well, for the part (2) of this question.

C. If this were actual experimental data that you obtained in the first set of experiments, what

would you do differently in the next set of experiments, to get the order and kinetic rate

constant without any ambiguity ?

Solution:

A. Integral method: Assume zero order reaction, plot C = Cinit-k0t, we get Cinit = 20.078

mol/lit(close enough), k0 = 0.2069 (mol/lit/min), R2 = 0.9908

Assume first order reaction, 1

0

k t

A AC C e or, 0 1ln lnA AC C k t .CA0= 20.35242 mol/lit, rate

constant k1 = 0.0127 min-1, R2 = 0.9938

y = -0.2069x + 20.078R² = 0.9908

0

5

10

15

20

25

0 10 20 30 40

C(mol/lit)

C(mol/lit)

Linear(C(mol/lit))

Page 5: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

Try fitting to 2nd order equation, 2

0

1 1

A A

k tC C

.

We get CA0 = 20.74689 mol/lit (bit off), k2 = 0.0008 lit/mol/min, R2 = 0.9881. Not too bad either

Differential method

y = -0.0127x + 3.0132R² = 0.9938

2.4

2.6

2.8

3

3.2

0 20 40

lnCa

lnCa

Linear (lnCa)

y = 0.0008x + 0.0482R² = 0.9881

0

0.02

0.04

0.06

0.08

0.1

0 20 40

1/C

1/C

Linear (1/C)

y = -0.0244x - 0.2391R² = 0.0209

-1.5

-1

-0.5

0

0 10 20 30

del-C vs C(mid)

delC

Linear(delC)

Page 6: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

B. The reason that zero, first and second order reactions all yield a reasonable fit is this: In case

of small ‘kt’ values, we can write 1 ....kte kt and 0

1 1

A A

ktC C

can be re-written as

0

0 0

00

0 0

1 11 ...

1 1 11

AA A A

AA

A A

CC C C kt

C ktkt C kt

C C

Thus, when the product ‘kt’ is

small and if there is lot of noise in the data, it is not possible to distinguish between the models.

C. The solution is to acquire data until we have large ‘kt’ value. One way is to increase the duration

(‘t’) of the experiment and another way is to increase the value of ‘k’ by increasing the temperature.

Page 7: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

4. Extraction of order from Half life data, acquired at different temperatures.

Tetrahydrofuran decomposes to form methane, ethane, propane, hydrogen, CO etc. The

initial pressure, temperature (maintained throughout a given experiment) and the half life

values are given below.

T °C 569 530 560 550 539

Initial P (mm

Hg)

214 204 280 130 206

t½ (min) 14.5 67 17.3 39 47

Determine the order of the reaction.

Solution:

Here, we can assume that ideal gas law is obeyed. Then, A AA

P NC

RT V Hence,

initial P/T is proxy for initial concentration. Note that we don't have multiple

concentration data at a fixed temperature.

(i) Assume order is not = 1

11

1 02

2 1

1

nn

At Ck n

, 0

E

RTk k e

.

1

0 012

1ln

2 1ln ln 1l

1n A

n Ek n

Tt

RC

n

This is y = a + bx1 + Cx2.

1

0

0

2 1ln ln

1

n

a kn k

, b = E/R, c = (1-n). We can

use analysis in Excel or Matlab or similar software (or do by hand), and we get a

= -29.76, b = 26666, c = -0.56. Order is roughly 1.5 , R2 = 0.999. I have used

Microsoft Excel ® Data Analysis --> Regression to get these.

Page 8: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

The confidence intervals are: We are 95% confident that ‘a’ is between -28.8 and -

30.8, ‘b’ is between 25.8K and 27.5K, and ‘c’ is between -0.49 and -0.63.

(ii) Assume that the order is 1.

For first order reaction,

12

ln 2t

k and 1 0

2

1ln ln ln 2 ln

Et k

R T , independent

of initial concentration. This also fits reasonably well, we have only 5 points. y =

27690 x -30.22, R2 = 0.948.

T °C

Initial

P (mm

Hg)

(min) T P/T

(min) 1/T

ln(t½

(min))

569 214 14.5 842 0.254157 14.5 0.001188 2.674149

530 204 67 803 0.254047 67 0.001245 4.204693

560 280 17.3 833 0.336134 17.3 0.0012 2.850707

550 130 39 823 0.157959 39 0.001215 3.663562

539 206 47 812 0.253695 47 0.001232 3.850148

The confidence intervals are: We are 95% confident that the slope is between 15.7

K and 39.6K , and the intercept is between -15.8 and -44.7.

On comparing these two sets of results, we can conclude that the order is indeed

1.5.

y = 27690x - 30.222R² = 0.948

0

1

2

3

4

5

0.00118 0.00119 0.0012 0.00121 0.00122 0.00123 0.00124 0.00125

ln(t½ (min))

Page 9: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

5. Complex kinetics – constant volume, isothermal batch reactor. Consider the

following gas phase reaction, conducted isothermally in a constant volume batch reactor.

Volume of the reactor is 100 lit.

1

1

k

kA B C

2kA B D

4

1 10r A mol/lit/s, 4

1 10r B C

mol/lit/s, 4

2 2 10r A B mol/lit/s

Determine the concentration of each species after 1 h. Given (i) initial mixture contains 5

mol B and 5 mol C (ii) initial mixture contains 2 mol each of A, B, C, D and inert (I).

Solution:

The design equation is ii

dNV r

dt , where the subscript 'i' can take values A,B,C, D and I. Of

course, inert material, by definition, does not participate in the reaction. It just dilutes the mixture

and keeps each species concentration low, thereby changing the reaction rate.

! 1 1 1 2 2, and r k A r k B C r k A B

1 1 2Ar r r r

1 1 2Br r r r

1 1Cr r r

2Dr r

Since it is a constant volume reactor, we can write the design equations as

1 1 2

1 1 2

1 1

2

A

B

C

D

A

Bd

C k A k B C k A Br

D k A k B C k A Br

k A k B Crdt

k A Br

Page 10: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

(i) initial concentrations [A]0 = 0, [B]0 = 5 mol/lit, [C]0 = 5 mol/lit, [D]0 = 0

(ii) initial concentrations [A]0 = [B]0 = [C]0 = [D]0 =[I]0 = 2 mol/lit

% Matlab program to solve this is given below.

%

% CRE I. Assignment 3. Example problem with multiple reactions

clear all; close all;

k1 = 1e-4; % 1/s

km1 = 1e-4; % lit/mol/s

k2 = 2e-4; % lit/mol/s

tfinal =3600; %seconds

CA0 = 0;

CB0 = 5;

CC0 = 5;

CD0 = 0;

Cinit = [CA0 CB0 CC0 CD0]';

p(1)=k1;p(2)=km1;p(3)=k2;

[t,Conc] = ode45(@(t,C)rate3(t,C,p),[0 3600],Cinit);

CA = Conc(:,1);% first column

CB = Conc(:,2); % second column

CC = Conc(:,3); %third column

CD = Conc(:,4);%fourth column

Page 11: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

figure;set(gcf,'color','w');

p1 = plot(t,CA,'-b*');hold on;

p2 = plot(t,CB,'-rd');

p3 = plot(t,CC,'--k');

p4 = plot(t,CD,'gs');

legend('[A]','[B]','[C]','[D]');

title('First part of question ');

% A variation of the problem.

CA0 = 2;

CB0 = 2;

CC0 = 2;

CD0 = 2;

Cinit = [CA0 CB0 CC0 CD0]';

[t,Conc] = ode45(@(t,C)rate3(t,C,p),[0 3600],Cinit);

CA = Conc(:,1);% first column

CB = Conc(:,2); % second column

CC = Conc(:,3); %third column

CD = Conc(:,4);%fourth column

figure;set(gcf,'color','w');

p1 = plot(t,CA,'-b*');hold on;

p2 = plot(t,CB,'-rd');

p3 = plot(t,CC,'--k');

p4 = plot(t,CD,'gs');

legend('[A]','[B]','[C]','[D]');

title('Second part - Initial conditions changed');

%% The following is stored in a separate file called rate3.m

Page 12: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the

function dC = rate3(t,C,p)

k1 = p(1);

km1 = p(2);

k2 = p(3);

CA = C(1);

CB = C(2);

CC = C(3);

dC = zeros(4,1);

r1 = k1 * CA; rm1 = km1 * CB * CC; r2 = k2 * CA * CB;

rA = -r1 + rm1 - r2;

rB = r1-rm1-r2;

rC = r1-rm1;

rD = r2;

dC(1) = rA;

dC(2)=rB;

dC(3)=rC;

dC(4)=rD;

end

----

Results are

Page 13: Tutorials 1. Confidence Intervals in parameter estimation ...srinivar/course/CRE/Tutorial_01_02.pdf · Complex kinetics – constant volume, isothermal batch reactor. Consider the