Korelasi Dan Regresi Linear Sederhana
Korelasi Dan Regresi Linear Sederhana
= =
2.316607 3.311596
CONTOH PERHITUNGAN DENGAN
KOMPUTER
CONTOH ADANYA OUTLIER
• KOEFISIEN KORELASI DENGAN ADANYA OUTLIER = +0,65
• Koefisien korelasi tanpa outlier = -0,89
Regresi: Metode Kuadrat Terkecil
9
q Mencari satu kurva atau satu fungsi (pendekatan) yang sesuai dengan
pola umum yang ditunjukkan oleh data
q Datanya menunjukkan kesalahan yang cukup signifikan
q Kurva tidak perlu memotong setiap titik data
q Regresi linear
q Regresi persamaan-persamaan tak-linear yang dilinearkan
q Regresi tak-linear
Regresi Linear
11
yreg = a0 + a1x a0 :
intercept
a1 :
slope, gradien
q M i crosoft
Excel
q
I NTERCEPT(y1:
y ;x :x )
The Least Square Method
yi xi yˆ i
y1 x1 b0 b1 x1
y2 x2 b0 b1 x2
y3 x3 b0 b1 x3
. . .
. . .
yn xn b0 b1 xn
n
Min Z (y i y i ) 2
i 1
n
Min Z (y i b0 b1 x i ) 2
i 1
Classic Minimization
n
Min Z (y i b0 b1 x i ) 2
i 1
We may remember from high school algebra that to find the minimum value we should get the
derivative and set it equal to zero.
Derivatives
n
Z ( y i b0 b1 x i ) 2
i 1
Z n
2( 1 )( y i b0 b1 x i ) 0
b0 i 1
Z n
2( x i )( y i b0 b1 x i ) 0
b1 i 1
B0 and b1
b1
xy ( x y ) / n
x ( x ) / n
2 2
b0 y b1 x
Example
Restaurant i xi yi xi yi xi2
1 2 58 116
2 6 105 630 4
3 8 88 704 36
4 8 118 944 64
5 12 117 1404 64
6 16 137 2192 144
7 20 157 3140 256
8 20 169 3380 400
9 22 149 3278 400
10 26 20 5252 484
676
b1
xy ( x y ) / n
x ( x ) / n
2 2
2840
b1 5
568
b0
y b0 b1 x
1300
y 130
10
140
x 14
10
130 b0 5 ( 14 )
b0 60
Estimated Regression Equation
y 60 5 x
y 60 5 ( 16 )
y 140 thousand dollars
Summary ; The Simple Linear Regression Model
where
yi = observed value of the dependent variable
for the i th observation
ŷi = estimated value of the dependent variable
for the i th observation
LATIHAN 1: TENTUKAN KOEFISIEN
KORELASI
DISKUSI A: BAGAIMANA KORELASI
BILA ADA OUTLIER?
• Bandingkan Data A dan Data B (yang ada outler)
• Data A
X 1 2 2 3 3 3 4 4 5 6 7 8 9
y 2 3 2 3 4 2 5 3 6 5 8 10 8
• Data B
X 1 2 2 3 3 3 4 4 5 6 7 8 9
y 2 3 2 3 4 70 5 3 6 5 8 10 8
DISKUSI B: BAGAIMANA REGRESI
LINEAR BILA ADA OUTLIER?
• Bandingkan Data A dan Data B (yang ada outler)
• Data A
X 1 2 2 3 3 3 4 4 5 6 7 8 9
y 2 3 2 3 4 2 5 3 6 5 8 10 8
• Data B
X 1 2 2 3 3 3 4 4 5 6 7 8 9
y 2 3 2 3 4 70 5 3 6 5 8 10 8