Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
43 views

Lect02 Regression Analysis

This document discusses regression analysis and nonlinear axes. It defines regression analysis as modeling the relationship between two or more variables, with one designated as the independent variable. Linear regression uses a linear equation to relate two variables, where the slope and intercept can be calculated using the method of least squares. An example is shown of fitting a straight line to a set of calibration data to determine the flow rate from rotameter readings. Two-point linear interpolation and extrapolation are also introduced to estimate y-values from a data set at input values within or outside the existing x-range.

Uploaded by

leo besa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Lect02 Regression Analysis

This document discusses regression analysis and nonlinear axes. It defines regression analysis as modeling the relationship between two or more variables, with one designated as the independent variable. Linear regression uses a linear equation to relate two variables, where the slope and intercept can be calculated using the method of least squares. An example is shown of fitting a straight line to a set of calibration data to determine the flow rate from rotameter readings. Two-point linear interpolation and extrapolation are also introduced to estimate y-values from a data set at input values within or outside the existing x-range.

Uploaded by

leo besa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Introduction to Chemical Engineering Calculations

Lecture 2.

Regression and Nonlinear Axes

Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
2 Regression and Nonlinear Axes

What is regression analysis?

A technique for modeling and analyzing the relationship


between 2 or more variables. Usually, 1 variable is
designated as the independent variable.

Purpose: Establish a mathematical relation between the


variables.

C(t) = e t

 2  a f(x)sin nπxdx  sin nx sinh ny


u(x,y) =   0 
n=1 a sinh (nπb/a)  a  a a

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
2
2 Regression and Nonlinear Axes

Linear Regression

An equation of a line is used to establish the relationship


between 2 variables x and y.

y = mx + b

where

y,x = dependent and independent variables, respectively.

m, b = slope and intercept, respectively.

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
3
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

Consider a rotameter calibration data:

Rotameter Reading Flow Rate (mL/min)


(independent variable) (dependent variable)

10 20.0

30 52.1

50 84.6

70 118.3

90 151.0

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
4
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
5
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

Calculating the slope and intercept using the method of


least squares:

Δy Sxy - Sx Sy
slope : m= =
Δx Sxx -  Sx 2

SxxSy - SxySx
intercept : b= 2
Sxx -  Sx 

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
6
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

Calculating the S-values:

1 n
S x (average of x values) =  xi
n i 1
1 n
S y (average of y values) =  y i
n i 1
2 1 n 2
S xx (average of x values) =  xi
n i 1
1 n
S xy (average of xy values) =  xi y i
n i 1

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
7
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

For the previous data set:

1
Sx = 10  30  50  70  90  = 50
5

1
Sy =  20.0  52.1  84.6  118.3  151.0   85.2
5

1 2
S xx =
5

10  302  502  702  902 = 3300 
1 10  20    30  52.1   50  84.6  
S xy =    5572.8
5   70 118.3    90  151.0  

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
8
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

Calculating the slope and intercept:

5572.8 -  50  85.2 
m 2
= 1.641
3300 -  50 

b
 3300  85.2  -  5572.8  50 
 3.15
2
3300 -  50 

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
9
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

Therefore, the mathematical relation for flow rate in terms


of the rotameter reading is:

y = 1.641x + 3.15

At any given value of x, a corresponding value for y can


easily be calculated using this equation.

For x = 25, y = 1.641(25) + 3.15 = 44.175

for x = 250, y = 1.641(250) + 3.15 = 413.40

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
10
2 Regression and Nonlinear Axes

Two-Point Linear Interpolation

Given the following set of data:

x 1.0 2.0 3.0 4.0


y 0.3 0.7 1.2 1.8

Supposed we want to know two values of y when:

1. x = 2.5
(x is between the range of data points: interpolation)

2. x = 5.0
(x is outside the range of data points: extrapolation)

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
11
2 Regression and Nonlinear Axes

Two-Point Linear Interpolation

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
12
2 Regression and Nonlinear Axes

Two-Point Linear Interpolation

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
13
2 Regression and Nonlinear Axes

Two-Point Linear Interpolation

If points 1, 2, and A lie on the same line, then

Slope (1-A) = Slope (1-2)

If slope is defined as y/x, then,

y - y 1 y 2 - y1
=
x - x1 x 2 - x1
Rearranging the equation,

x - x1
y = y1 +  y 2 - y1 
x 2 - x1

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
14
2 Regression and Nonlinear Axes

Two-Point Linear Interpolation

Two-point interpolation can be used when extracting values


from a tabular data.

Consider the following tabular data:

x 1 2 3
y 1 4 8

Find the value of y when x = 1.3.

1.3 - 1
y=1+  4 - 1 = 1.9
2- 1

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
15
2 Regression and Nonlinear Axes

Fitting Nonlinear Data

For simple non-linear equations, linearization can be done


by manipulating or plotting the data so that it can be
expressed analogously as a linear equation.

Original equation: y = mx2 + b


Linearized Form: y = mw + b (with w = x2)

Original equation: sin y = m(x2 – 4) + b


Linearized Form: u = aw + b
(with w = x2 – 4 and u = sin y)

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
16
2 Regression and Nonlinear Axes

Fitting Nonlinear Data

A mass flow rate M(g/s) is measured as a function of


temperature T(0C).

T(0C) 10.0 20.0 40.0 80.0


M 14.76 20.14 27.73 38.47

There is reason to believe that m varies linearly with the


square root of T:

M = aT1/2 + b

Determine the values and units of a and b.

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
17
2 Regression and Nonlinear Axes

Fitting Nonlinear Data

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
18
2 Regression and Nonlinear Axes

Fitting Nonlinear Data

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
19
2 Regression and Nonlinear Axes

Fitting Nonlinear Data

Linearizing the data set:

T 10.0 20.0 40.0 80.0


T1/2 3.162 4.472 6.325 8.944

M 14.76 20.14 27.73 38.47

The values of a (slope) and b (intercept) can be determined


using the method of least squares as discussed previously.

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
20
2 Regression and Nonlinear Axes

Fitting Nonlinear Data

Calculate for SX, SY, SXX, and SXY:

X (T1/2) Y (M) X2 XY

3.162 14.76 10.00 46.68

4.472 20.14 20.00 90.07

6.325 27.73 40.00 175.38

8.944 38.47 80.00 344.09

SX = 5.726 SY = 25.275 SXX = 37.50 SXY = 164.05

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
21
2 Regression and Nonlinear Axes

Fitting a Straight Line to a Set of Data Points

Calculate the slope (a) and intercept (b):

(164.05) - (5.726)(25.275)
slope : a= 2
 4.100
(37.50) -  5.726 

(37.50)(25.275) - (164.05)(5.726)
intercept : b= 2
 1.798
(37.50) -  5.726 

Apply dimensional consistency to get the units of a and b:

a = 4.100 g/(s-0C1/2) and b = 1.798 g/s

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
22
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
23
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
24
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
25
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
26
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
27
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
28
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
29
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

1. If y versus x data appear linear on a semilog plot, then


ln(y) versus x would be linear on a rectangular plot, and
the data can therefore be correlated by an exponential
function:

y = aebx
2. If y versus x data appear linear on a log plot, then ln(y)
versus ln(x) would be linear on a rectangular plot, and
the data can therefore be correlated by a power
function:

y = axb

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
30
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

A plot of F versus t yields a straight line that passes


through the points (t1 = 15, F1 = 0.298) and (t2 = 30, F2 = 0.0527)
on a log plot. Determine the mathematical equation that
relates F and t.

If linear on a logarithmic plot, then,

F = atb

Linearizing the equation,

ln (F) = ln (a) + b ln(t)

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
31
2 Regression and Nonlinear Axes

Nonlinear Axes: The Logarithmic Coordinates

Determine a and b:

Δ  ln(F) ln(F2 /F1 ) ln(0.0527/.298)


b= = = = -2.50
Δ  ln(t) ln(t 2 /t1 ) ln(30/15)

To determine a:

ln (a) = ln (F1) – b ln(t1) or ln (a) = ln (F2) – b ln(t2)

Using the first data point,

ln (a) = ln (0.298) – b ln(15) = 5.559


a = exp (5.559) = 260

SLIDE
Prof. Manolito E Bambase Jr. Department of Chemical Engineering. University of the Philippines Los Baños
32

You might also like