Presentation is loading. Please wait.

Presentation is loading. Please wait.

10/11/2015 1 Nonlinear Regression Chemical Engineering Majors Authors: Autar Kaw, Luke Snyder

Similar presentations


Presentation on theme: "10/11/2015 1 Nonlinear Regression Chemical Engineering Majors Authors: Autar Kaw, Luke Snyder"— Presentation transcript:

1 10/11/2015 http://numericalmethods.eng.usf.edu 1 Nonlinear Regression Chemical Engineering Majors Authors: Autar Kaw, Luke Snyder http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates

2 Nonlinear Regression http://numericalmethods.eng.usf.edu http://numericalmethods.eng.usf.edu

3 Nonlinear Regression Some popular nonlinear regression models: 1. Exponential model: 2. Power model: 3. Saturation growth model: 4. Polynomial model:

4 Nonlinear Regression Given n data pointsbest fit to the data, whereis a nonlinear function of. Figure. Nonlinear regression model for discrete y vs. x data

5 Regression Exponential Model

6 Exponential Model Givenbest fitto the data. Figure. Exponential model of nonlinear regression for y vs. x data

7 Finding constants of Exponential Model The sum of the square of the residuals is defined as Differentiate with respect to a and b

8 Finding constants of Exponential Model Rewriting the equations, we obtain

9 Finding constants of Exponential Model Substitutingback into the previous equation The constantcan be found through numerical methods such as the bisection method or secant method. Nonlinear equation in terms of Solving the first equation foryields

10 Example 1-Exponential Model t(hrs)013579 1.0000.8910.7080.5620.4470.355 Many patients get concerned when a test involves injection of a radioactive material. For example for scanning a gallbladder, a few drops of Technetium-99m isotope is used. Half of the techritium-99m would be gone in about 6 hours. It, however, takes about 24 hours for the radiation levels to reach what we are exposed to in day-to-day activities. Below is given the relative intensity of radiation as a function of time. Table. Relative intensity of radiation as a function of time.

11 Example 1-Exponential Model cont. Find: a) The value of the regression constantsand b) The half-life of Technium-99m c) Radiation intensity after 24 hours The relative intensity is related to time by the equation

12 Plot of data

13 Constants of the Model The value of λ is found by solving the nonlinear equation

14 Setting up the Equation in MATLAB t (hrs)013579 γ 1.0000.8910.7080.5620.4470.355

15 Setting up the Equation in MATLAB t=[0 1 3 5 7 9] gamma=[1 0.891 0.708 0.562 0.447 0.355] syms lamda sum1=sum(gamma.*t.*exp(lamda*t)); sum2=sum(gamma.*exp(lamda*t)); sum3=sum(exp(2*lamda*t)); sum4=sum(t.*exp(2*lamda*t)); f=sum1-sum2/sum3*sum4;

16 Calculating the Other Constant The value of A can now be calculated The exponential regression model then is

17 Plot of data and regression curve

18 Relative Intensity After 24 hrs The relative intensity of radiation after 24 hours This result implies that only radioactive intensity is left after 24 hours.

19 Homework 1. What is the half-life of technetium 99m isotope? 2. Compare the constants of this regression model with the one where the data is transformed. 3. Write a program in the language of your choice to find the constants of the model.

20 THE END http://numericalmethods.eng.usf.edu

21 Polynomial Model Givenbest fit to a given data set. Figure. Polynomial model for nonlinear regression of y vs. x data

22 Polynomial Model cont. The residual at each data point is given by The sum of the square of the residuals then is

23 Polynomial Model cont. To find the constants of the polynomial model, we set the derivatives with respect to whereequal to zero.

24 Polynomial Model cont. These equations in matrix form are given by The above equations are then solved for

25 http://numericalmethods.eng.usf.edu 25 Example 2-Polynomial Model Below is given the FT-IR (Fourier Transform Infra Red) data of a 1:1 (by weight) mixture of ethylene carbonate (EC) and dimethyl carbonate (DMC). Absorbance P is given as a function of wavenumber m. Wavenumber, m ( ) Absorbance, P (arbitrary unit) 804.1840.1591 827.3260.0439 846.6110.0050 869.7530.0073 889.0380.0448 892.8950.0649 900.6090.1204 Table. Absorbance vs Wavenumber data Figure. Absorbance vs. Wavenumber data

26 http://numericalmethods.eng.usf.edu 26 Example 2-Polynomial Model cont. Regress the data to a second order polynomial where and find the absorbance at The coefficientsare found as follows

27 http://numericalmethods.eng.usf.edu 27 Example 2-Polynomial Model cont. The necessary summations are as follows i Wavenumber, m ( ) Absorbance, P (arbitrary unit) m2m2 m3m3 1804.180.15916.4671×10 5 5.2008×10 8 2827.330.04396.8447×10 5 5.6628×10 8 3846.610.00507.1675×10 5 6.0681×10 8 4869.750.00737.5647×10 5 6.5794×10 8 5889.040.04487.9039×10 5 7.0269×10 8 6892.900.06497.9726×10 5 7.1187×10 8 7900.610.12048.1110×10 5 7.3048×10 8 6030.40.44545.2031×10 6 4.4961×10 9 Table. Necessary summations for calculation of polynomial model constants

28 http://numericalmethods.eng.usf.edu 28 Example 2-Polynomial Model cont. Necessary summations continued: i m4m4 m × P m 2 × P 1 4.1824×10 11 127.951.0289×10 5 2 4.6849×10 11 36.3193.0048×10 4 3 5.1373×10 11 4.2333.583×10 3 4 5.7225×10 11 6.3495.522×10 3 5 6.2471×10 11 39.8283.5409×10 4 6 6.3563×10 11 57.9485.1742×10 4 7 6.5787×10 11 108.439.7655×10 4 3.8909×10 12 381.063.2685×10 5 Table. Necessary summations for calculation of polynomial model constants.

29 http://numericalmethods.eng.usf.edu 29 Example 2-Polynomial Model cont. Using these summations we have Solving this system of equations we find The regression model is then

30 http://numericalmethods.eng.usf.edu 30 Example 2-Polynomial Model cont. With the model is given by Figure. Polynomial model of Absorbance vs. Wavenumber.

31 http://numericalmethods.eng.usf.edu 31 Example 2-Polynomial Model cont. To findwherewe have

32 Linearization of Data To find the constants of many nonlinear models, it results in solving simultaneous nonlinear equations. For mathematical convenience, some of the data for such models can be linearized. For example, the data for an exponential model can be linearized. As shown in the previous example, many chemical and physical processes are governed by the equation, Taking the natural log of both sides yields, Letand (implying)with We now have a linear regression model where

33 Linearization of data cont. Using linear model regression methods, Onceare found, the original constants of the model are found as

34 Example 3-Linearization of data t(hrs)013579 1.0000.8910.7080.5620.4470.355 Many patients get concerned when a test involves injection of a radioactive material. For example for scanning a gallbladder, a few drops of Technetium- 99m isotope is used. Half of the technetium-99m would be gone in about 6 hours. It, however, takes about 24 hours for the radiation levels to reach what we are exposed to in day-to-day activities. Below is given the relative intensity of radiation as a function of time. Table. Relative intensity of radiation as a function of time Figure. Data points of relative radiation intensity vs. time

35 Example 3-Linearization of data cont. Find: a) The value of the regression constantsand b) The half-life of Technium-99m c) Radiation intensity after 24 hours The relative intensity is related to time by the equation

36 Example 3-Linearization of data cont. Exponential model given as, Assuming,andwe obtain This is a linear relationship betweenand

37 Example 3-Linearization of data cont. Using this linear relationship, we can calculate and where

38 Example 3-Linearization of Data cont. 123456123456 013579013579 1 0.891 0.708 0.562 0.447 0.355 0.00000 −0.11541 −0.34531 −0.57625 −0.80520 −1.0356 0.0000 −0.11541 −1.0359 −2.8813 −5.6364 −9.3207 0.0000 1.0000 9.0000 25.000 49.000 81.000 25.000−2.8778−18.990165.00 Summations for data linearization are as follows Table. Summation data for linearization of data model With

39 Example 3-Linearization of Data cont. Calculating Since also

40 Example 3-Linearization of Data cont. Resulting model is Figure. Relative intensity of radiation as a function of temperature using linearization of data model.

41 Example 3-Linearization of Data cont. The regression formula is then b) Half life of Technetium 99 is when

42 Example 3-Linearization of Data cont. c) The relative intensity of radiation after 24 hours is then This implies that onlyof the radioactive material is left after 24 hours.

43 Comparison Comparison of exponential model with and without data linearization: With data linearization (Example 3) Without data linearization (Example 1) A0.999740.99983 λ−0.11505−0.11508 Half-Life (hrs)6.02486.0232 Relative intensity after 24 hrs. 6.3200×10 −2 6.3160×10 −2 Table. Comparison for exponential model with and without data linearization. The values are very similar so data linearization was suitable to find the constants of the nonlinear exponential model in this case.

44 Additional Resources For all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit http://numericalmethods.eng.usf.edu/topics/nonlinear_r egression.html

45 THE END http://numericalmethods.eng.usf.edu


Download ppt "10/11/2015 1 Nonlinear Regression Chemical Engineering Majors Authors: Autar Kaw, Luke Snyder"

Similar presentations


Ads by Google