3. Regresi
Regresi adalah suatu teknik untuk
mendapatkan fungsi secara umum yang
dapat mewakili atau menyatakan pola data
Regresi adalah suatu teknik untuk
memperoleh fungsi pendekatan yang
jaraknya paling kecil dari semua data
Bila terdapat data (xi,yi) maka regresi
akan menghasilkan fungsi pendekatan
ŷ = f(x)
4. Regresi
Jarak antara fungsi
pendekatan dengan data
untuk x yang sama
(Persamaan Sebaran)
adalah
Untuk memperoleh jarak
terdekat digunakan teknik
differensial yang
menyatakan jarak
terdekat atau minimum
pada:
0
k
a
S
n
i
i
y
i
y
S
1
2
)
ˆ
(
6. Persamaan dan Model sebagai obyek regresi
Secara empiris, persamaan matematis tertentu
yang sering digunakan di antaranya adalah
(a). Persamaan ‘garis lurus’ (linier):
y = ax + b
(b). Persamaan parabolis (kuadratis):
(c). Persamaan polinomial (secara umum):
(d). Persamaan multilinier:
(e). Persamaan tak linear
r
qx
px
y
2
0
1
2
2
...
1
1 a
x
a
x
a
m
x
m
a
m
x
m
a
y
2
2
1
1
0 x
a
x
a
a
y
7. Regresi Linear
Regresi linier adalah suatu teknik regresi
dengan fungsi pendekatan linier.
Dengan kata lain pada regresi linier akan
diperoleh fungsi linier y=ax + b, yang
paling dekat dengan data.
2
)
( b
ax
y
S
8. Regresi Linier
Maka, persamaan differensial yang harus
terpenuhi:
Setelah syarat terpenuhi, maka akan
terbentuk persamaan matrik berikut:
0
a
S
0
b
S
y
xy
b
a
n
x
x
x2
10. Quantification of Error of Linear
Regression
Standard deviation and standard
error
r 2 is called the coefficient of determination and r is the
correlation coefficient (=√r 2)
For a perfect fit, Sr = 0 and r 2 = 1, signifying that the line
explains 100% of the variability of the data.
11. Examples of linear regression with (a) small
and (b) large residual errors
14. Diketahui data sebagai berikut:
Tentukan persamaan regresi linearnya?
Jawab:
Koefisien matriknya yaitu:
Dengan n=10
20
8
8
6
4
5
4
1
2
1
10
9
8
7
6
5
4
3
2
1
y
x
55
x 59
y
385
2
x 451
xy
Ex2:
15. Sehingga didapatkan konstanta a dan b dengan
rumus:
Maka, persamaan regresi linearnya yaitu:
Lanjutkan Hitung standard deviasi Sy standard
eror Sy/x dan r
2
)
(
2 x
x
n
y
x
xy
n
a
2
)
(
2
2
x
x
n
xy
x
y
x
b
53333
.
1
1
a 53333
.
2
0
a
b
53333
.
2
53333
.
1
x
y
17. Flowchart
MULAI
Input data (xi, yi)
Hitung a dan b menggunakan
rumus:
Masukkan nilai a dan b dalam
persamaan y=ax + b
Selesai
2 2
( )
n xy x y
a
n x x
2
2 2
( )
x y x xy
b
n x x
18. LINEARIZATION OF NONLINEAR RELATIONSHIPS
(a) The exponential equation, (b) the power equation, and (c) the saturation-growth-rate
equation. Parts (d), (e), and (f ) are linearized versions of these equations that result from
simple transformations.
20. Least-squares fit of a power
model to the data from Ex1
(a) The fit of the
transformed data.
(b) The power equation fit
along with the data.
Continue Ex 2 for
transformed data
21. Problems 1
1. (a) determine intercept, slope, standard eror
and correlation coefficient
(b).determine the slope in the least square fit for a
straight line with a zero intercept, and plot
2. (a) determine intercept, slope, standard eror
and correlation coefficient
(b) Linearized the model using transformations
(c) Plot the straight line and linearized data point
23. Regresi Polinomial
Regresi polynomial adalah suatu bentuk regresi
dengan fungsi pendekatan yang berupa fungsi
polinomial
Dengan fungsi sebaran:
Persamaan differensial yang harus terpenuhi:
Standard error
2
)
0
...
1
( a
m
x
m
a
m
x
m
a
y
S
0
m
a
S
0
1
m
a
S
0
0
a
S
24. (a) Data that are ill-
suited for linear least-
squares regression. (b)
Indication that a
parabola is preferable.
25. Regresi Polinomial
Berdasarkan metode Least Square,
dengan jarak fungsi pendekatan dan data
diperoleh model regresi dalam bentuk
matrik sebagai berikut:
n
i
i
y
n
i
i
y
i
x
n
i
i
y
i
x
i
y
n
i
m
i
x
i
y
n
i
m
i
x
a
a
a
m
a
m
a
N
n
i
i
x
n
i
i
x
n
i
m
i
x
n
i
m
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
m
i
x
n
i
m
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
n
i
m
i
x
1
1
1
2
...
1
1
1
0
1
2
...
1
1
1
2
...
1
1
1
1
1
2
1
3
...
1
1
1
1
2
1
3
1
4
...
1
1
1
2
...
...
...
...
...
...
1
1
1
1
1
...
1
2
2
1
1
2
1
1
1
1
2
...
1
1
2
1
2
26. Regresi Polinomial
Jika m = 1, maka persamaan matriknya:
Jika m = 2, maka persamaan matriknya:
n
i
i
y
n
i
i
y
i
x
a
a
n
n
i
i
x
n
i
i
x
n
i
i
x
1
1
0
1
1
1
1
2
n
i
i
y
n
i
i
y
i
x
n
i
i
y
i
x
a
a
a
n
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
1
1
1
2
0
1
2
1
1
2
1
1
2
1
3
1
2
1
3
1
4
27. Regresi Polinomial
Ex.3:
Dapatkan persamaan kuadrat yang paling
sesuai dengan data berikut:
Jawab:
10
6
4
3
1
0
2
4
8
7
6
5
4
3
2
1
y
x
n
i
i
y
n
i
i
y
i
x
n
i
i
y
i
x
a
a
a
n
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
n
i
i
x
1
1
1
2
0
1
2
1
1
2
1
1
2
1
3
1
2
1
3
1
4
28. Regresi Polinomial
Konstanta Matriknya adalah:
Maka, model matriknya:
36
x
30
y
204
2
x 1296
3
x 8772
4
x
173
xy 1181
2y
x
30
173
1181
0
1
2
8
36
204
36
204
1296
204
1296
8772
a
a
a
29. Regresi Polinomial
Dengan menggunakan elimininasi Gauss
Jordan diperoleh:
Maka, persamaan kuadrat yang diperoleh
adalah:
52
,
4
0
a 998
,
1
1
a 06
,
0
2
a
52
,
4
998
,
1
2
06
,
0
x
x
y
32. Flowchart
MULAI
Input data (xi, yi)
Bentuk Matrik Regresi Polinomial:
Hitung Koefisien Matrik
Selesai
Selesaikan Persamaan Matrik
dengan metode eliminasi gauss
34. Regresi Multilinier
Bentuk umum dari persamaan multilinier
adalah
Dengan fungsi sebaran:
Persamaan differensial yang harus
terpenuhi:
)
...
2
2
1
1
0
)
,...,
2
,
1
( m
x
m
a
x
a
x
a
a
n
x
x
x
y
2
)
...
2
2
1
1
0
(
m
x
m
a
x
a
x
a
a
i
y
S
0
0
a
S
0
1
a
S
0
2
a
S
0
m
a
S
35. Regresi Multilinier
Setelah persyaratan terpenuhi, maka akan
terbentuk matrik :
i
y
i
m
x
i
y
i
x
i
y
x
i
x
y
m
a
a
a
a
i
m
x
i
x
mi
x
i
x
mi
x
i
m
x
mi
x
i
x
i
x
i
x
i
x
i
x
mi
x
i
x
i
x
i
x
i
x
i
x
i
m
x
i
x
i
x
n
2
1
1
...
2
1
0
2
...
2
1
...
...
...
...
...
2
...
2
2
1
2
2
1
...
2
1
2
1
1
...
2
1
37. Regresi Multilinier
Persamaan matriknya sebagai berikut:
y x1
x2
x1
2 x2
2 x1
x2
x1
y x2
y
5 0 0 0 0 0 0 0
10 2 1 4 1 2 20 10
9 2,5 2 6,25 4 5 22,5 18
0 1 3 1 9 3 0 0
3 4 6 16 36 24 12 18
27 7 2 49 4 14 189 54
∑ = 54 ∑ = 16,5 ∑ = 14 ∑ = 76,25 ∑ = 54 ∑ = 48 ∑ = 243,5 ∑ = 100
y
x
y
x
y
a
a
a
x
x
x
x
x
x
x
x
x
x
n
2
1
2
1
0
2
2
2
1
2
2
1
2
1
1
2
1
38. Regresi Multilinier
Maka, Persamaan matriknya adalah:
Setelah menggunakan eliminasi gauss,
didapatkan:
Jadi, persamaan multiliniernya adalah:
100
5
,
243
54
2
1
0
54
48
14
48
25
,
76
5
,
16
14
5
,
16
6
a
a
a
5
0
a 4
1
a 3
2
a
2
3
1
4
5 x
x
y
39. Flowchart
MULAI
Input data (xi, yi)
Bentuk Matrik Regresi Multilinier
Hitung Koefisien Matrik
Selesai
Selesaikan Persamaan Matrik
dengan metode eliminasi gauss
40. Problem 3
The following data were collected for the steady flow of
water in a concrete circular pipe:
41. Regresi Tak Linier
Seperti halnya dengan regresi lainnya,
regresi tak linear didasarkan pada
penentuan seperti nilai-nilai parameter
yang meminimumkan jumlah kuadrat dari
sisanya
Namun, untuk kasus tak linear
penyelesaiannya haruslah berjalan dengan
cara iterasi yang penyelesaian-
penyelesaian yang beruntun sering kali
tergantung pada tebakan-tebakan awal
parameter
42. Regresi Tak Linier
Persamaan Tak Linier yaitu:
Persamaan umumnya yaitu:
Dalam bentuk matrik yaitu:
i
e
m
a
a
a
i
x
f
i
y
)
,...,
1
,
0
;
(
i
e
a
a
j
i
x
f
a
a
j
i
x
f
j
i
x
f
i
y
1
1
)
(
0
0
)
(
)
(
E
A
j
Z
D
43. Regresi Tak Linier
Dimana:
Maka, persamaan untuk model regresinya
yaitu:
1
0
1
2
0
2
1
1
0
1
...
...
a
fn
a
f
a
f
a
f
a
f
a
f
Z
n
j
)
(
...
)
2
(
2
)
1
(
1
xn
f
n
y
x
f
y
x
f
y
D
1
0
a
a
A
D
T
j
Z
A
j
Z
T
j
Z
44. Regresi Tak Linier
Solusi dari persamaan matrik tersebut
adalah {ΔA}, yang akan digunakan untuk
memperbaiki tebakan awal tersebut
dengan rumus:
Prosedur ini diulang sampai nilai ε
dibawah kriteria penghentian yang dapat
diterima
0
)
(
0
)
1
(
0 a
j
a
j
a
1
)
(
1
)
1
(
1 a
j
a
j
a
%
100
)
1
(
)
(
)
1
(
j
k
a
j
k
a
j
k
a
k
a
45. Regresi Tak Linier
Ex.6:
Cocokkan fungsi
pada data:
dengan tebakan awal a0 dan a1 =1
Jawab:
x1 y
0,25 0,28
0,75 0,57
1,25 0,68
1,75 0,74
2,25 0,79
x
a
e
a
a
a
x
f 1
1
)
,
;
( 0
1
0
x
a
xe
a
a
f 1
0
1
x
a
e
a
f 1
1
0
47. Regresi Tak Linier
Maka nilai {ΔA} dapat dihitung
menggunakan persamaan regresi tak
linier, yaitu
Sehingga
0365
,
0
1533
,
0
0 D
T
Z
5019
,
0
2714
,
0
A
5019
,
1
7286
,
0
5019
,
0
2714
,
0
0
,
1
0
,
1
1
0
a
a
48. Flowchart
Konverge
n
(εk < ε )
MULAI
Input data (xi, yi), Tebakan
awal, ε
Bentuk Matrik Regresi Taklinier
Hitung Koefisien Matrik
Selesai
Selesaikan Persamaan Matrik
dengan metode eliminasi gauss
No
Yes
49. Regresi Tak Linier
Selain menggunakan metode regresi tak linear,
akar-akar persamaan tak linear juga dapat dicari
dengan mengubah persamaan tersebut ke
bentuk polynomial seperti contoh di bawah ini:
1. Persamaan y =
ln (y) = ln (a) + b ln( x)
misalkan y’ = ln (y), a’ = ln (a), x’ = ln
(x). Sehingga persamaannya menjadi:
y’ = a’ + bx’
b
ax
50. Regresi Tak Linier
2. Persamaan y =
ln (y) = ln (a) + bx
Yang dapat dituliskan dalam bentuk
polynomial:
y’ = a’ + bx
bx
ae
52. References
Chapra, Steven C. Applied numerical methods with
MATLAB for engineers and scientists / Steven C.
Chapra. 3rd ed.
Basuki, Ahmad dan Nana Ramadijanti. 2005.Metode
Numerik dan Algoritma Komputasi. Yogyakarta:
Andi
Hoffman, Joe D.1993.Numerical Methods For
Enginers And Scientist. Singapore: McGraw-Hill
Kelompok 7:Asmaria Syahrosi, dkk, Menum