Modul 3 PDF
Modul 3 PDF
Modul 3:
Regresi Linier dengan Metode Kuadrat Terkecil
= ax + b
p x2 + q x + r
= c1 + c2 x + c3 x 2 + L + ck x k 1 + L + c n x n 1
ck x k 1
k =1
+cx+ d
= a eb x
a x2 + b x
cx + d
= ax + b
dengan:
a = kelandaian (slope) kurva garis lurus
b = perpotongan (intercept) kurva dengan ordinat
atau sumbu tegak
Intellectual Property of DR. Ir. Setijo Bismo, DEA., TGP-FTUI
Regresi yang dimaksudkan disini adalah: pencarian hargaharga tetapan a dan b berdasarkan deretan data yang ada
(jumlah atau pasangan data x-y sebanyak N buah).
Sebagai contoh, di bawah ini diberikan 1 set data (x-y)
sebanyak 7 buah:
Tabel 1. Set data regresi linier.
-3
-0.22
-2
0.67
-1
1.55
1.99
2.55
3.25
4.11
4.11
3.25
2.55
intercept
1.99
1.55
slope
0.67
-0.22
-1
-5
-4
-3
-2
-1
= ( y a x b )2
dS
da
= 0; dan
(b).
dS
db
= 0.
d
2
( y a x b)
da
persamaan berikut:
( y a x b ) ( x) = 0 , atau
a x2 + b x = x y
(b).
(A)
d
2
= 0,
( y a x b)
db
terbentuk persamaan berikut:
sehingga
kemudian
( y a x b ) (1) = 0 , atau
ax + N b = y
(B)
sebagai berikut:
x 2 x a
x N b
x y
y
(C)
x y
det
y
x 2
det
x
x
N
; dan
b =
x 2
det
x
x 2
det
x
x y
y
x
x N
[ x
x y x
det
y
N
[ xy N
N ( x )2
x y ]
dan
x 2 x y
det
x y
[ x
y x xy
b =
[ xy N
x y ]
= 0,684143; dan
2
2
x N ( x )
[ x y x x y ]
[ x N ( x ) ]
2
= 1,985000
Tugas di rumah:
Coba buat program dalam FORTRAN untuk mencari hargaharga a dan b dari satu set data berikut:
No.
1
2
3
4
5
6
7
x
-1.0
1.0
3.0
5.0
7.0
9.0
11.0
y
5.00
9.00
13.00
17.00
21.00
25.00
29.00
p x2 + q x + r
Regresi yang dimaksudkan disini adalah: pencarian hargaharga tetapan p, q dan r berdasarkan set data yang diberikan
(ingat: jumlah atau pasangan data x-y sebanyak N buah !).
Intellectual Property of DR. Ir. Setijo Bismo, DEA., TGP-FTUI
= y p x2 q x r
)2
(c).
dS
dr
= 0;
= 0; dan
= 0.
2
d
y p x2 q x r
d p
persamaan berikut:
= 0 , yang membentuk
2
2
y p x q x r ( x ) = 0 , atau
p x 4 + q x3 + r x 2
(b).
= x2 y
2
d
y p x2 q x r
d q
(E)
= 0 , yang membentuk:
2
y p x q x r ( x) = 0 , atau
p x3 + q x 2 + r x = x y
(c).
2
d
2
y
p
x
q
x
r
d r
(F)
= 0 , dan dihasilkan
2
y p x q x r ( 1) = 0 , atau
p x2 + q x + r N
= y
(G)
x 2 y
= x y
(H)
x 2 y
det x y
y
x 4
det x 3
x 2
3
2
x x
2
x
x
x N
;
3
2
x x
2
x x
x N
x 4
det x 3
x 2
x 4
det x 3
x 2
2
2
x y x
x
y
x
N
y
; dan
3
2
x x
2
x x
x N
x 4
det x 3
x 2
x 4
det x 3
x 2
3
2
x x y
2
x
x
y
x y
3
2
x x
2
x x
x N
det x 3 x 2 x
x2
x N
4
2
3
2
x x N + x x x +
( )3
( x2 ) x4 N ( x3 )2
= x 2 x3 x x 2
2
2
3
x 2 y x 3 x 2
x yx N + x x y +
2
det x y x 2 x = x 2 x y x x 2 y
2
y
2
3
(
x N
x) x y N x y x
( )
x 4 x 2 y x 2
det x 3 x y x
x2
N
y
4
2
2
x xy N + x y x x +
( )2
= x 2 x3 y x 2 x y
4
3
2
x x y N x x y
dan
x 4 x3 x 2 y
det x 3 x 2 x y
x2
x y
4
2
2
3
x x y + x x xy +
( )2 x2 y
4
32
x x x y ( x ) y
= x x3 x 2 y x 2
Tugas di rumah:
Coba buat program dalam FORTRAN untuk mencari hargaharga p, q dan r berdasarkan kurva di bawah ini:
6.00
4.00
2.00
0.00
-2.00
-4.00
-6.00
-4.0
-2.0
0.0
2.0
4.0
No.
1
2
3
4
5
6
x
-3.0
-2.2
-0.9
-0.1
1.2
2.5
y
4.00
-0.16
-4.19
-4.99
-3.56
1.25
= c3 x 3 + c2 x 2 + c1 x + c0
Regresi yang dimaksudkan disini adalah: pencarian hargaharga parameter c0 sampai dengan c3 berdasarkan set data
yang diberikan (ingat: pasangan data x-y selalu berjumlah N
buah !).
Persamaan sebaran (S) yang menyatakan sesatan terdistribusi
dari persamaan linier tersebut dinyatakan sebagai:
= y c3 x 3 c2 x 2 c1 x c0
)2
(a ).
dS
d c0
= 0;
(b).
dS
d c1
= 0;
(c).
dS
d c2
= 0; dan
(d).
dS
d c3
= 0
2
d
3
2
y
c
x
c
x
c
x
c
3
2
1
0
d c3
= 0,
3
2
3
y c3 x c2 x c1 x c0 ( x ) = 0 , atau
c3 x 6 + c2 x 5 + c1 x 4 + c0 x 3
(b).
d
d c2
= x3 y
y c x3 c x 2 c x c 2
3
2
1
0
(I)
= 0,
membentuk:
3
2
2
y c3 x c2 x c1 x c0 ( x ) = 0 , atau
c3 x 5 + c2 x 4 + c1 x 3 + c0 x 2
(c).
= x2 y
2
d
y c3 x 3 c2 x 2 c1 x c0
d c1
(J)
= 0,
dihasilkan:
Intellectual Property of DR. Ir. Setijo Bismo, DEA., TGP-FTUI
3
2
y c3 x c2 x c1 x c0 ( x) = 0 , atau
c3 x 4 + c2 x 3 + c1 x 2 + c0 x = x y
d
d c0
(d).
y c x3 c x 2 c x c 2
3
2
1
0
(K)
= 0,
dihasilkan:
3
2
y c3 x c2 x c1 x c0 (1) = 0 , atau
c3 x 3 + c2 x 2 + c1 x + c0 N
= y
(L)
5
4
3
x x x c3
4
3
2
x x x c2
3
2
x x x c1
2
x
x
N
c0
x 3 y
2
x y
=
x y
(M)
Tugas Kelompok:
Buat program dalam FORTRAN untuk mencari harga-harga
konstanta dari c0 sampai cn dari suatu persamaan
polinomial, dari order 3 (n = 3) sampai dengan order 7 (n =
7). Artinya, program tersebut dapat menangani sembarang
polinomial dari order 3 sampai 7 bahkan lebih tinggi lagi.
Gunakan subroutine EGAUSS untuk solusi SPAL yang
terbentuk, dan buat program yang membaca data dari file
ASCII (text file, dengan ekstensi *.dta).
Intellectual Property of DR. Ir. Setijo Bismo, DEA., TGP-FTUI
F. Regresi Multilinier
Beberapa persamaan aljabar dapat membentuk suatu relasi
linier atau yang sejenisnya, antara beberapa variabel bebas
(independent variables) dengan sebuah variabel terikat
(dependent variable). Relasi tersebut seringkali dijumpai dalam
dunia keteknikan, termasuk hasil logaritmik dari persamaanpersamaan analisis adimensional ataupun relasi analogi
bilangan-bilangan tak berdimensi.
Bentuk umum dari persamaan multilinier seperti di atas dapat
disederhanakan dalam relasi fungsi matematis berikut:
y (u , v , w )
c1 u + k 2 v + k3 w
= ( y c1 x1 c2 x2 c3 x3 L cn xn )2
(a ).
dS
d c1
= 0;
(b).
dS
d c2
= 0;
(c).
dS
d c3
= 0;
dS
d cn
= 0
M
(d).
d
2
( y c1 x1 c2 x2 c3 x3 L cn xn )
d c1
= 0,
(b).
d
2
( y c1 x1 c2 x2 c3 x3 L cn xn )
d c2
= x1 y
(O)
= 0,
= x2 y
(P)
(c).
d
2
( y c1 x1 c2 x2 c3 x3 L cn xn )
d c3
= 0,
M
(d).
d
2
( y c1 x1 c2 x2 c3 x3 L cn xn )
d cn
= x3 y
(Q)
= 0,
= xn y
(R)
x1 xn
x1 y
x1 x2 x1 x3 L x1 xn c1
x y
2
x2
x2 x3 L x2 xn c2
2
2
L x3 xn c3 = x3 y
x2 x3 x3
M
M
M
M
O M
2 c
x2 xn x3 xn L xn n
xn y
(S)
G. Soal-soal Latihan
1. Vargaftik (1975) memperkenalkan suatu data kapasitas
Intellectual Property of DR. Ir. Setijo Bismo, DEA., TGP-FTUI
Cp
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
1,426
1,447
1,469
1,492
1,516
1,541
1,567
1,596
1,627
1,661
1,696
1,732
1,770
1,808
1,848
1,888
0,2
0,75
0,5
0,55
1,0
0,21
1,5
0,13
2,0
0,04
0,8
0,8
0,8
0,4
0,4
0,4
0,2
0,2
0,2
300
400
500
300
400
500
300
400
500
C
ea / T
1 + 0,3 C
N 3
Re
10,800
5,290
3,120
14,400
6,620
8,700
4,250
8,570
2,900
4,950
14,800
7,480
9,170
4,720
16,300
13,000
7,700
2,330
Sc
0,60
0,60
1,80
1,80
1,875
1,875
1,86
1,86
2,16
2,16
2,17
2,17
2,26
2,26
1,83
1,83
1,61
1,61
H. Daftar Pustaka
Atkinson, Kendal E., An Introduction to Numerical Analysis, John
Wiley & Sons, Toronto, pp. 44-48, 1978.
Atkinson, L.V., Harley, P.J., An Introduction to Numerical
Methods with Pascal, Addison-Wesley Publishing Co., Tokyo,
pp. 49-51, 1983.
Hanna, O.T., Sandall, O.C., Computational Methods in Chemical
Engineering, Prentice-Hall International Inc., Englewood Cliffs,
New Jersey, pp. 121-149, 1995.
Press, W.H., Flannery, B.P., Teukolsky, S.A., dan Vetterling, W.T.,
Numerical Recipes, Cambridge Univ. Press, 1986.