Curve Fitting Linear 1
Curve Fitting Linear 1
2
Regression & Interpolation
• Curve Fitting Given a set of discrete points how do you fill in the
points in between to form a continuum?
• Approximation or regression
• Find a simple function that represents the trend of the curve given that the
data may have measurement error or “noise”
• Those methods allow for evaluating the dependency of one variable on
other variables. They are used to find trends in the analyzed data and
quantify them. Regression analysis attempt to precisely predict the value of
a dependent variable from the values of the independent variables. I
• Interpolation
• The data is exact, so you need to find a function that passes through all the
given points
• The approximated function should pass through all the points in the
previously known set. Then, it could be used to estimate other points not
included in the set.
3
Basic statistics
าเฉล
• Arithmetic means
วนเ ยงเบนมาต
่ ด แต่ล ะ าอ ่ างฉาก
• Standard derivation ่า
It is a measure of how far each observed value is
from the mean.
อ ลกระจ ายมา ก ค.แ ปรปร รนม
The degree of spread in your
ควา มแปรปรว data set. The more spread the
• Variance data, the larger the variance is
in relation to the mean
<V. ่ง า ก.ปร :ม าณ าย
• Coefficient of variations The lower the value of the coefficient of
variation, the more precise the estimate.
ส นส. การ แปร
https://www.biologyforlife.com/standard-deviation.html 4
ส่
ค่
ค่
มู
ข้
ค่
ต่
ที
ค่
ห่
วั
ยู
ยิ
ผั
บี่
Height
SD1
Means
SD1
https://www.mathsisfun.com/data/standard-deviation.html
5
A second finding is that the histograms become narrower (and therefore higher) as we move
from trial 1 to trial 10; this illustrates that reaction times vary less and less between our
participants as the experiment progresses. The variance decreases over trials.
https://www.spss-tutorials.com/variance-what-is-it/
6
Coefficient of variations
https://unityweb.qcnet.com/Documentation/Help/UnityWeb/402.htm
7
Basic statistics
-ร
8
9
Histogram
แสดง การกระจา ย ว
ั
ว ม กจะเ า ใก การแจ กแจ งแน
• A histogram used to depict the distribution of data. For large
data set, the histogram often approaches the normal
distribution อม ลท ์ใก ค่า ฉ ย จะ เ
ปกต
NOUMA distribution = ก. แจกแจง ู
= วนเ ยงเบนมาตร
The nomenclature 𝑦𝑦 and 𝒔𝒔𝒚𝒚 refer to the sample
mean and standard deviation, respectively. The
nomenclature µ and σ refer to the population
mean and standard deviation, respectively.
= าเฉล
จะ วนเ ยงเบนมาต
10
ข้
ส่
ตั
ลื
ส่
ค่
ล้
ล้
ข้
บี่
บี่
𝑃𝑃 𝐿𝐿 ≤ 𝜇𝜇 ≤ 𝑈𝑈 = 1 − 𝛼𝛼
Two-side interval
The probability that the true mean of y, µ, falls within
the bound from L to U is 1-α. ่วงความ
α = significant level (1-α=confident interval)
0. 25,
𝑡𝑡𝛼𝛼⁄2,𝑛𝑛−1 Read form the table
SEXt =
#xt 12
ม๋
Weight ( 9 ) confidenc
Nati
10 07 ความคลาดเค ่อนมาตรฐาน >S
1003
SE = = = 5.65
99
1
↑ ↑
99 ↳ 51 &12
2.5 2.5
99 SE = 1.5
9ค 1 = 14
=996.21 + 3.2 6
997 1 = 51. = 0.05 twO tails
า One tai =999.47
998
1 3
of = D- 1 = 14- 1 = ก ฝง ละ 1 <- (SEX VALUES
1005 (2) LOWER =
= 992.95
992.95 - M 1 999.47
(1 == 3.6
ก็
ถ้
ั่
ลื
ประมาณ ณ า า3 คร
>เอา ่ามาจา
ตาราง
t
13
ค่
ค่
#
1 * ข
D= 8 : &F = 1- 1 = 8- 1:7 6.59
-Value = 1,365
0.009921
⑤
SE = 6 =
5 = 6.5794, Sy = 0.095845
= 6. Sy = 0.09713
95:20nfiden (% %
&= 0.05 ( twO thils)
+Value = 2.069
+Vale = 2.137
SE = Sy = 0.097133 = 0.028254
# 23
↳= 6,5799- 0.095845 ( 2.731) = 6.5208
1
CI=SEX tvalue = 0.028254 X 2.069
0= 6,5799 + 0.095845 ( 2.131) = 6.6389 /
1 (1 = 0.0419
&5 = จน. ไ จา กท -
=จน. อม ูล ห์ใ
ู
-
↳
14
ความ น
ข้
ผั
มั่
ด้
15
Linear Least-Squares Approximation
• The goal is to make a linear function that comes close to
fitting the given data points
• The closeness is determined by the error or residual
𝑦𝑦 = 𝑎𝑎0 + 𝑎𝑎1 𝑥𝑥 + 𝑒𝑒
𝑒𝑒 = 𝑦𝑦 − 𝑎𝑎0 − 𝑎𝑎1 𝑥𝑥
17
18
Any line passing through mid-points would satisfy the
criteria Positive and negative errors can cancel out
20
Least-Squares fit of a straight line
21
Least square fit of a straight line How many profit in 2005 S.
บอก แกน * - 1987.5
a= 2
4
=100 = 18
ท 6
b = 2 ( X- /4 = 385 = 0.69
↑
2 <X- 3 4 7.5
APPrOX
↳
+ 4
* *
Year( X Profit # 2x = 11925
1 1 I I
19 75 1อ
34 = 10
( 2 f 9
1408 1
4 4
ก=6
1 1)
1985 15
· 4 2x2 = 23701 375
14 36 1 990 O
· 5 40 04 3xY = 214955
1995 2)
9 7 13 8
200 28
1 · 8 12
=6 24-10
14 9 116 19
8
3XY = 364 24 = Y = UX+ b, h =
ID = 56 34 = 40 524
HD
24 = 92 X +
8
Y = UX+ b, h =
2x4 = & 2X'+ b2X
HD
24 = 92 X + 9 = 0.64
22
x = 18 Y = UX+ b, H = 7
Ex = HD
14 24 = 92 X +
4 = 0.039 x + 0.871
22
-
st-Sr ลด errOU ได
St = ผลรวม ของ ก ง 2ร
(JA
Total sum of the squares around
The standard error of estimate the mean for the dependent
variable, y, is St
าเฉ ยเลข
Based on a set of data (N point) arithmetic average
St = CY-)
sr = ผลรวม ก ลัง(ข ของเ ศษ
รอบ เ นฤ ดถอ
น (M Sy/x = าวชมอรมาตรฐานขอ Sum of the squares of
ย ด การประมาณ residuals around the
Liner least square approx. Sy/x Standard error of estimate
regression line is Sr
St-Sr qualifies the improvement or error
reduction due to describing data in terms of
straight line rather than as an average value
ป บป ุง err
The improvement of the total error is determined by r2
(coefficient of determination) and r is the correlation
coefficient
=สปส. การก หนด = คสพ. าสป
Sy/x < Sy the linear regression
model has good fitness jy/x < Sy เ นรถแบบกา
ลด ถอน ท เห นาะท
&
23
&
ค่
วั
ที่
ส้
ำ
ำ
สุ
รั
ลั
ที่
ลี่
รุ
ำ
ค่
ค่
ป็
ค่
Sx/y Spread around the
regression line
Sy Spread around
the mean
24
JSXY
:SSxY
~
standard error Of estimat
B =
SSxX I
SSE = 65xy-
Use data belOW tO Find SA
S: SSE S
SB1 =
2
* Y
# ↑" xx
H-) c SSXX
4
1 ↳ ! 2
↳ 2 4 4
=SSXY =9 = 0.9
10
3 soxx
4
7) 12
4
S 16 9 SSE = 11.2- 0.9 ( 9) = 3.1
1
5 · 25 36 3
S= 3.1 =1,076530845
2) = 1 5 =55 2x4 = 68 5-
34=17 <Y = 69
=1.0165 = 0.3215
SSxx = 2x- 12x) = 10
1
H /
SSxy = 2XY- 2x24 = 9 ไ ค วร โ
#
U
ง่
วิ
วิ
ม่
ช้
2
Sp
𝑦𝑦 = 0.07124857 + 0.8392857𝑥𝑥
Sp
SYN =
-I
St- SU
=
I
+
25
เอา สมการ มาจาก ตม. ทีแล
ตย. ม พ
↓ ↑ * ใช้ว อ. ไว
2
& Al
ก
𝑦𝑦 = 0.07124857 + 0.8392857𝑥𝑥
Sp Cy- /
SYN = by =
-I -1
24 = =14 119.5=1409+ 28
17,0.5) หา <yi- 40 - dexist
4 = 0.039 x + 0.871 20.5- 0.071- 8.839213( = 0.5 6
+- 0.039x- 0.071 25
ลื
วิ
ธี
พิ
พ์
Linearization of non-linear relationship
• A few types of nonlinear function can be transformed into linear
regression problem
• Exponential model
• Power equation
• Saturation-growth-rate equation
26
27
Y* X* a0 a1
ln y x ln α1 β1
log y log x log α2 β2
𝑦𝑦 ∗ = 𝑎𝑎0 +𝑎𝑎1 𝑥𝑥 ∗
linear: Y = 9 + bx
x= ax 28
Fittin power FUNCTION Y = &X
↑2
* 4 logx logy XY
4= ax
·
10 = 1092 -> %
%
18910 => 10
x= 18 %ex A
a= =
1= A + bx
UX+ b
2x => 3 ( 1094)
} แค
Y=
่เป ยน 2xY => 2 C 109x109Y)
HD
24 = 92 X + 2x ==> 3 <109X
2x4 = & 2X'+ b2X
2x2 => 2 ( 109X
ลี
(1) Y= ab* dePl
(2) 4=
1094 = 1099 + x189b
1094 = 189 9 + bx1092
1094 = 1,099 + 1096. /
Y , 1099 = A, blog
2 :
A + BX
1094 =
Y= &= 109b
Y= At BA
=109 !
Y = UX+ b
1= &X + by A= B= b1092
24 = 99X+
HD => =109 b = A = 10 9 A
#1094
Find the curve fit x = de** Using Method
Of ledSt sqUAr
5.76 = $( 34) + 5 A
3 = 34 24 = 5.76
48.92 = $( 300) + 34 A
<X = 380
#
1 10 2XY = 40.92
B = 0.025
5 1 1.18 B= bloge
A= 1099
7 12 1.08 A = 0.9788
9 1 1.18
ไม่ องแปล ง
a= 18
0.9788 = 9.52
1,0593 /
12 21 1.3
↓ เพราะ ↑ไม่ไ เปล
↓ b= antil092 2)
1,094 = 1899 + bxloge ีเป
ท ่ม ๆ เ shift -> 109 ( 109)
Y= UX+ h=
1,0593
(
HD
24 = 92 X + เป ่ยน ว วแปรเ
2x4 = & 2X'+ b2X
~
4 = BX + A
24 = B2X+HA
x= &X + b
9= 7.75 = B = B
=- 0.3 = A = 10982
&3 = 10: 03: 8.
29
Y= BX + A
2.134
↓
2 < 109X) = 1.769 2 ( 189x1894) = 1.4 B= 2 = 1,75
4= BX + A A= 109 & (
180.3 = 52 = 0.5
SY = BSX + H A
1.75
4 = 0.5/
2xY = B2X+A2X
2,134 = B 22.079) + 5 A
=1.7491 = 1.5
A = - 0.3
29
4 2 ( 10914.1894) - 2 2109X) /094
4 22109X) - ( 2109x)
30
Example ดต ดเ ป
Determine the slope that results in the least-squares fit for a straight line with a zero intercept. Fit the following data
with this model and display the result graphically: 14
12
10
8
Y
6
·
4
/
2
0
The sum of the squares of the residuals for this case can be written as, 0 5 10 15 20 25
X
Therefore, the slope can be computed as,
31
ตั
จุ
Practice in class
x y
1 1.5
2 4.5
3 6
4 8.5
5 11
32