0% found this document useful (0 votes)
11 views

Lecture 7 - Regression 2

Engineering skills 7

Uploaded by

tovi challenger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lecture 7 - Regression 2

Engineering skills 7

Uploaded by

tovi challenger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Basic Linear Interpolation

UGI

Rubar Dizayee
TIPS
• Check the minimum
and maximum values in
your data set (samples).
• The axes do not have to
start at 0!!!
• The scale on an axes
should be constant (log
plot excluded)!
TIPS

This length represents


1 year!
TIPS
What’s wrong about this plot?

Time
2010 2011 2012 2013 2014
Problem solving
Example
The upward velocity of a rocket is t [s] v(t) [m/s]

given as a function of time in the 0 0

10 227.04
Table. 15 362.78

- Determine the value of the velocity 20 517.35

at t=16 using linear interpolation. 22.5 602.97

30 901.67
Problem solving
Solution
X= 16 Y=?
y = y1 + ((x – x1)/(x2 - x1)) * (y2 - y1) X1= 15, Y1=362.78
Y= 393.694 m/s X2= 20, Y2= 517.35
Problem solving

Example
Find the value of y at x = 4 given some set of values (2, 4), (6, 7)?
Problem solving
Solution
Given the known values are,
X= 4
X1 = 2 Y1 = 4
y = y1 + ((x – x1)/(x2 - x1)) * (y2 - y1) X2 = 6 Y2 = 7
Y= 5.5
Problem solving
Example
The temperature in Erbil city at 2pm was 35C and at 7pm it was 26C.
Find the temperature at 6pm.
Problem solving
Solution
X=6 Y=?
y = y1 + ((x – x1)/(x2 - x1)) * (y2 - y1) X1= 2 Y1= 35
Y= 27.8C X2= 7 Y2= 26
Problem solving
Example
From the given data set calculate Time Depth
the depth at 4hrs? 1 0
3 4
5 8
7 12
9 16
Problem solving
Problem solving
Solution 18

Y= 2X-2 16 y = 2x - 2
14

Y= (2*4)-2 12

Y= 6 10

Depth
6

0
0 1 2 3 4 5 6 7 8 9 10

-2
Time
Problem solving
Example
1) What is the value of sales on a day
when the temperature is 20 °C.

2) Find the slope of the line?


Problem solving
Solution

b= Y/ X
(20, 445) (21.7, 499)

b= (y2-y1)/(x2-x1)
b=34.2
(15, 270)
377.83 18.03
Y=a+(bx)
Y=445.2 a=y-bx
a=-238.8
Regression Analysis
Your company is running a production line that produces barrels of
fluid. They collect the following data of output (in barrels) with
corresponding run time of the production line (in hours).

Run Time 4 5 6 7 8 9 10 11
(hours)
Production 76.4 78.5 81.5 87.8 88.4 92.4 94 95
(barrels)

1. What’s the average rate of production?


2. Make a model of the production based on run time.
3. Predict the number of barrels produced after 8.5 hours of run time.
Regression Analysis
Your company is running a production line that produces barrels of
fluid. They collect the following data of output (in barrels) with
corresponding run time of the production line (in hours).

Run Time 4 5 6 7 8 9 10 11
(hours)
Production 76.4 78.5 81.5 87.8 88.4 92.4 94 95
(barrels)

1. What’s the average rate of production?


2. Make a model of the production based on run time.
3. Predict the number of barrels produced after 8.5 hours of run time.
Regression Analysis What does the
slope represent?
Barrels produced Barrels produced per hour

Barrels
produced

hour
Regression Analysis The slope between each point is not the same.
In fact they can be very different!
Barrels produced

So how do I find the average


rate of barrels produced?
Regression • Model
Analysis Make a… • Line of best fit for the data
Barrels produced • Linear regression
All different ways to
say the same thing
model for the data Called the “Coefficient of
determination,” 𝑅2 or more
𝑦 = 2.869 𝑥 + 65.23 informally the “goodness of fit.”
2 𝑅2 ranges from 0 to 1.
𝑅 = 0.963 1 = Perfect fit
0 = No fit at all

To get each one of these data


points, it cost a lot of money!!! So
the model is cheaper to run and
predict output once we have it!
Regression What’s the average rate of production? Use the model!!
Analysis
2.869 𝑏𝑎𝑟𝑟𝑒𝑙𝑠/ℎ𝑜𝑢𝑟
Barrels produced

model for the data


𝑦 = 2.869 𝑡 + 65.23
2
𝑅 = 0.963 Barrels
produced

hour
Regression Predict the number of barrels produced after 8.5
Analysis hours of run time. Use the model!!!
Barrels produced 2.869 8.5 + 65.23 = 89.61 𝑏𝑎𝑟𝑟𝑒𝑙𝑠

model for the data


𝑦 = 2.869 𝑡 + 65.23
2
𝑅 = 0.963

You might also like