Analisi Regresi dengan Dummy Variable
REGRESI LINEAR SEDERHANA
y
(x5,y5)
●
d5
(x3,y3)
●
d3
d2
●
(x2,y2)
d4
●
(x4,y4)
d
1
●
(x1,y1)
x
Definisi:
Dari semua kurva pendekatan terhadap
satu set data, kurva yang memenuhi sifat
bahwa nilai S=d12+d22+...+dN2 adalah
minimum disebut dengan kurva terbaik
yang mewakili data.
Koefisien Diterminasi
yi − yˆi )
(
∑
= 1−
2
∑ ( yi − y )
2
R
2
Interpretasi koefisien diterminasi:
100(R2)% variasi sampel dalam y dapat
dijelaskan dengan menggunakan x untuk
memprediksi y pada model linear.
Problem 1: Regresi Linear Sederhana
Bagaimana pengaruh
harga terhadap sales
suatu produk ?
Dapatkah meramal
sales suatu produk
berdasarkan harganya ?
Input (X)
Harga Produk
Controllable Factors
F1 , F2 , …, Fq
Process
(Model Regresi)
Z1 , Z2 , …, Zq
Uncontrollable Factors
Harga Pesaing, Selera Konsumen, Kondisi
Ekonomi Nasional ( inflasi dll) dan faktor lain
yang tidak dapat dikontrol dalam kondisi TETAP
Biaya I klan, Jumlah
Outlet, Area Pemasaran dan faktor lain
yang dapat dikontrol
dalam kondisi TETAP
Output (Y)
Sales Produk
Tahap-tahap dalam Analisis Regresi
1. Plot data
 identifikasi bentuk hubungan secara grafik
2. Koefisien Korelasi
 identifikasi hubungan linear dengan suatu angka
n
Ö rxy =
∑ ( xi
i =1
n
∑ ( xi
i =1
− x )( y i − y )
− x)2
n
∑ ( yi
, -1 ≤ rxy ≤ 1
− y) 2
i =1
3. Pendugaan ( estimasi) model regresi
4. Evaluasi ( diagnostic check) kesesuain model regresi
5. Prediksi ( forecast) suatu nilai Y pada suatu X tertentu
Problem 1: Data hasil pengamatan …
Minggu
Sales
(ribu unit)
Harga
(ribu rupiah)
1.
10
1.3
2.
6
2.0
3.
5
1.7
4.
12
1.5
5.
10
1.6
6.
15
1.2
7.
5
1.6
8.
12
1.4
9.
17
1.0
10.
20
1.1
(continued)
Plot antara Harga dan Sales
Pengamatan dilakukan dengan mengambil
secara random data 10 minggu penjualan
Problem 1: MINITAB output …
(continued)
MTB > Correlation 'Harga' 'Sales'.
Pearson correlation of Harga and Sales = -0.863
P-Value = 0.001
MTB > Regress 'Sales' 1 'Harga'
The regression equation is
Sales = 32.1 – 14.5 Harga
Predictor
Constant
Harga
S = 2.725
Coef
32.136
-14.539
SE Coef
4.409
3.002
R-Sq = 74.6%
T
7.29
-4.84
P
0.000
0.001
R-Sq(adj) = 71.4%
Analysis of Variance
Source
Regression
Residual Error
Total
DF
1
8
9
SS
174.18
59.42
233.60
MS
174.18
7.43
F
23.45
P
0.001
Problem 1: MINITAB output …
(continued)
Plot data, garis regresi dan
ramalan Sales dari Harga
Linearisasi Persamaan Pangkat Sederhana
Contoh Soal:
a=1,8515
b=0,1981
Hitung: c = ea = e1,8515 = 6,369366
Jadi y = cxb = 6,368366x0,1981
Linearisasi Model eksponensial y=c.ebx
Problem 2: Regresi Linear Berganda
Bagaimana pengaruh
harga dan biaya iklan
terhadap sales suatu
produk ? Lebih baikkah
ketepatan ramalannya ?
Input (X)
Harga
Produk
Biaya
Iklan
Controllable Factors
F1 , F2 , …, Fq
Process
(Model Regresi)
Z1 , Z2 , …, Zq
Uncontrollable Factors
Harga Pesaing, Selera Konsumen, Kondisi
Ekonomi Nasional ( inflasi dll) dan faktor lain
yang tidak dapat dikontrol dalam kondisi TETAP
Jumlah Outlet, Area
Pemasaran dan faktor
faktor lain yang dapat
dikontrol dalam kondisi
TETAP
Output (Y)
Sales Produk
Problem 2: Data hasil pengamatan …
Sales
Harga
Biaya Iklan
(ribu unit)
(ribu rupiah)
(juta rupiah)
1.
10
1.3
9
2.
6
2.0
7
3.
5
1.7
5
4.
12
1.5
14
5.
10
1.6
15
6.
15
1.2
12
7.
5
1.6
6
8.
12
1.4
10
9.
17
1.0
15
10.
20
1.1
21
Minggu
Pengamatan dilakukan dengan mengambil
secara random data 10 minggu penjualan
(continued)
Plot antara Harga, Iklan dg Sales
Problem 2: MINITAB output …
MTB > Correlation 'Sales''Iklan'.
(continued)
MTB > Regress 'Sales' 2 'Harga'
'Iklan'
The regression equation is
Correlations:
Sales, Harga, Iklan
Harga
Iklan
Sales
-0.863
0.001
0.891
0.001
Harga
-0.654
0.040
Cell Contents:
Pearson correlation
P-Value
Sales = 16.4 - 8.25 Harga + 0.585 Iklan
Predictor
Constant
Harga
Iklan
Coef
16.406
-8.248
0.5851
SE Coef
4.343
2.196
0.1337
S = 1.507
R-Sq = 93.2%
T
3.78
-3.76
4.38
P
0.007
0.007
0.003
R-Sq(adj) = 91.2%
Analysis of Variance
Source
DF
Regression 2
Residual
7
Total
9
SS
217.70
15.90
233.60
MS
108.85
2.27
F
P
47.92 0.000
Problem 2: MINITAB output …
R2 = 74.6%
R2 = 79.5%
(continued)
R2 = 93.2%
Problem 3: Regresi dengan Variabel Dummy
Bagaimana pengaruh TES
BAKAT dan GENDER thd
produktifitas ? Dapatkah
produktifitas pekerja
diramal dari tes bakat dan
jenis kelaminnya?
F1 , F2 , …, Fq
Process
Input (X)
Nilai
TES BAKAT
pekerja
Controllable Factors
(Model Regresi)
JENIS
KELAMIN
pekerja
Z1 , Z2 , …, Zq
Uncontrollable Factors
Emosi ( suasana hati) pekerja dan faktor lain
yang tidak dapat dikontrol dalam kondisi TETAP
Usia, Pendidikan,
Ruang kerja, Mesin
dan faktor faktor lain
yang dapat dikontrol
dalam kondisi TETAP
Output (Y)
Produktifitas
pekerja
Problem 2: Data hasil pengamatan …
Pengamatan dilakukan dengan mengambil
secara random data 15 pekerja
(continued)
Plot antara Tes Bakat dan Produktifitas, antara pekerja PRI A dan
WANI TA
Problem 3: MINITAB output …
MTB > Correlation
(continued)
'Tes Bakat' 'Dummy' 'Produktifitas'.
Produktifitas
Tes Bakat
0.876
0.000
Dummy
-0.021
0.940
MTB > Regress 'Produktifitas' 2 'Tes Bakat' 'Dummy'
The regression equation is
Produktifitas = - 4.14 + 0.120 Tes Bakat + 2.18 Dummy
Predictor
Constant
Tes Bakat
Dummy
S = 0.7863
Coef
-4.1372
0.12041
2.1807
SE Coef
0.8936
0.01015
0.4503
R-Sq = 92.1%
T
-4.63
11.86
4.84
P
0.001
0.000
0.000
R-Sq(adj) = 90.8%
Problem 3: MINITAB output …
(continued)
Problem 3: Plot hasil regresi …
(continued)
WANI TA
PRI A
Model-model Time Series Regression
1. Model Regresi untuk LI NEAR TREND
Yt = a + b.t + error
Ö t = 1, 2, … ( dummy w aktu)
2. Model Regresi untuk Data SEASONAL ( variasi konstan)
Yt = a + b1 D 1 + … + bS-1 D S-1 + error
dengan : D 1 , D 2 , …, D S-1 adalah dummy w aktu dalam
satu periode seasonal.
3. Model Regresi untuk Data dengan LI NEAR TREND dan
SEASONAL ( variasi konstan)
Yt = a + b.t + c1 D 1 + … + cS-1 D S-1 + error
 Gabungan model 1 dan 2.
Problem 4: Regresi Trend Linear
(Video Store case)
Time Series Plot data Sales
Problem 4: Hasil Regresi Trend dg MINITAB …
(continued)
Problem 4: Hasil Regresi Trend dg MINITAB …
(continued)
Problem 5: Regresi Data Seasonal …
(Data Electrical Usage)
Time Series Plot
( Data seasonal)
Problem 5: Hasil regresi dengan MINITAB …
MTB > Regress 'Kilowatts' 3 'Kuartal-1'-'Kuartal-3'
The regression equation is
Kilowatts = 722 + 281 Kuartal.1 - 97.4 Kuartal.2 - 202 Kuartal.3
Predictor
Constant
Kuartal.1
Kuartal.2
Kuartal.3
S = 30.84
Coef
721.60
281.20
-97.40
-202.20
SE Coef
13.79
19.51
19.51
19.51
R-Sq = 97.7%
Analysis of Variance
Source
DF
Regression
3
Residual Error
16
Total
19
SS
646802
15220
662022
T
52.32
14.42
-4.99
-10.37
P
0.000
0.000
0.000
0.000
R-Sq(adj) = 97.3%
MS
215601
951
F
226.65
P
0.000
Problem 5: Struktur dummy dan hasil regresinya …
Dummy Variable
Problem 5: Hasil regresi dengan MINITAB …
Forecast
Time Series Plot
( Data dan Ramalannya)
Problem 6: Regresi Data Trend Linear dan Seasonal …
Time Series Plot
( Data trend dan seasonal)
Problem 6: Hasil regresi dengan MINITAB …
Dummy Variable
Problem 6: Hasil regresi dengan MINITAB …
MTB > Regress 'Sales' 4 't' 'Kuartal.1'-'Kuartal.3'
The regression equation is
Sales = 413 + 19.7 t + 130 Kuartal.1 - 108 Kuartal.2 - 228 Kuartal.3
16 cases used 4 cases contain missing values
Predictor
Constant
t
Kuartal.1
Kuartal.2
Kuartal.3
S = 35.98
Coef
412.81
19.719
130.41
-108.06
-227.78
SE Coef
26.99
2.012
26.15
25.76
25.52
R-Sq = 96.3%
T
15.30
9.80
4.99
-4.19
-8.92
P
0.000
0.000
0.000
0.001
0.000
R-Sq(adj) = 95.0%
Analysis of Variance
Source
Regression
Residual Error
Total
DF
4
11
15
SS
371967
14243
386211
MS
92992
1295
F
71.82
P
0.000
Problem 6: Hasil regresi dengan MINITAB …
Forecast
Time Series Plot
( Data dan Ramalannya)
Perbandingan ketepatan ramalan antar metode …
Kasus Sales Video Store
Model
Kasus Sales Data Kuartalan
Kriteria kesalahan ramalan
MSE
MAD
MAPE
Double
M.A.
66.6963
6.68889
0.9557
Holt’s
Method
28.7083
4.4236
0.6382
Regresi
Trend
21.6829
3.73048
0.5382
Holt’s Method :
Alpha (level): 0.202284
Gamma (trend): 0.234940
Kriteria kesalahan ramalan
Model
MSE
MAD
MAPE
Winter’s
Method
4372.69
52.29
9.67
Regresi
Trend &
Seasonal
890.215
23.2969
4.3122
Winter’s Method :
Alpha (level): 0.4
Gamma (trend): 0.1
Delta (seasonal): 0.3
Tugas : Carilah model peramalan terbaik untuk dua
data sales (produk A dan B) berikut ini.
y
(x5,y5)
●
d5
(x3,y3)
●
d3
d2
●
(x2,y2)
d4
●
(x4,y4)
d
1
●
(x1,y1)
x
Definisi:
Dari semua kurva pendekatan terhadap
satu set data, kurva yang memenuhi sifat
bahwa nilai S=d12+d22+...+dN2 adalah
minimum disebut dengan kurva terbaik
yang mewakili data.
Koefisien Diterminasi
yi − yˆi )
(
∑
= 1−
2
∑ ( yi − y )
2
R
2
Interpretasi koefisien diterminasi:
100(R2)% variasi sampel dalam y dapat
dijelaskan dengan menggunakan x untuk
memprediksi y pada model linear.
Problem 1: Regresi Linear Sederhana
Bagaimana pengaruh
harga terhadap sales
suatu produk ?
Dapatkah meramal
sales suatu produk
berdasarkan harganya ?
Input (X)
Harga Produk
Controllable Factors
F1 , F2 , …, Fq
Process
(Model Regresi)
Z1 , Z2 , …, Zq
Uncontrollable Factors
Harga Pesaing, Selera Konsumen, Kondisi
Ekonomi Nasional ( inflasi dll) dan faktor lain
yang tidak dapat dikontrol dalam kondisi TETAP
Biaya I klan, Jumlah
Outlet, Area Pemasaran dan faktor lain
yang dapat dikontrol
dalam kondisi TETAP
Output (Y)
Sales Produk
Tahap-tahap dalam Analisis Regresi
1. Plot data
 identifikasi bentuk hubungan secara grafik
2. Koefisien Korelasi
 identifikasi hubungan linear dengan suatu angka
n
Ö rxy =
∑ ( xi
i =1
n
∑ ( xi
i =1
− x )( y i − y )
− x)2
n
∑ ( yi
, -1 ≤ rxy ≤ 1
− y) 2
i =1
3. Pendugaan ( estimasi) model regresi
4. Evaluasi ( diagnostic check) kesesuain model regresi
5. Prediksi ( forecast) suatu nilai Y pada suatu X tertentu
Problem 1: Data hasil pengamatan …
Minggu
Sales
(ribu unit)
Harga
(ribu rupiah)
1.
10
1.3
2.
6
2.0
3.
5
1.7
4.
12
1.5
5.
10
1.6
6.
15
1.2
7.
5
1.6
8.
12
1.4
9.
17
1.0
10.
20
1.1
(continued)
Plot antara Harga dan Sales
Pengamatan dilakukan dengan mengambil
secara random data 10 minggu penjualan
Problem 1: MINITAB output …
(continued)
MTB > Correlation 'Harga' 'Sales'.
Pearson correlation of Harga and Sales = -0.863
P-Value = 0.001
MTB > Regress 'Sales' 1 'Harga'
The regression equation is
Sales = 32.1 – 14.5 Harga
Predictor
Constant
Harga
S = 2.725
Coef
32.136
-14.539
SE Coef
4.409
3.002
R-Sq = 74.6%
T
7.29
-4.84
P
0.000
0.001
R-Sq(adj) = 71.4%
Analysis of Variance
Source
Regression
Residual Error
Total
DF
1
8
9
SS
174.18
59.42
233.60
MS
174.18
7.43
F
23.45
P
0.001
Problem 1: MINITAB output …
(continued)
Plot data, garis regresi dan
ramalan Sales dari Harga
Linearisasi Persamaan Pangkat Sederhana
Contoh Soal:
a=1,8515
b=0,1981
Hitung: c = ea = e1,8515 = 6,369366
Jadi y = cxb = 6,368366x0,1981
Linearisasi Model eksponensial y=c.ebx
Problem 2: Regresi Linear Berganda
Bagaimana pengaruh
harga dan biaya iklan
terhadap sales suatu
produk ? Lebih baikkah
ketepatan ramalannya ?
Input (X)
Harga
Produk
Biaya
Iklan
Controllable Factors
F1 , F2 , …, Fq
Process
(Model Regresi)
Z1 , Z2 , …, Zq
Uncontrollable Factors
Harga Pesaing, Selera Konsumen, Kondisi
Ekonomi Nasional ( inflasi dll) dan faktor lain
yang tidak dapat dikontrol dalam kondisi TETAP
Jumlah Outlet, Area
Pemasaran dan faktor
faktor lain yang dapat
dikontrol dalam kondisi
TETAP
Output (Y)
Sales Produk
Problem 2: Data hasil pengamatan …
Sales
Harga
Biaya Iklan
(ribu unit)
(ribu rupiah)
(juta rupiah)
1.
10
1.3
9
2.
6
2.0
7
3.
5
1.7
5
4.
12
1.5
14
5.
10
1.6
15
6.
15
1.2
12
7.
5
1.6
6
8.
12
1.4
10
9.
17
1.0
15
10.
20
1.1
21
Minggu
Pengamatan dilakukan dengan mengambil
secara random data 10 minggu penjualan
(continued)
Plot antara Harga, Iklan dg Sales
Problem 2: MINITAB output …
MTB > Correlation 'Sales''Iklan'.
(continued)
MTB > Regress 'Sales' 2 'Harga'
'Iklan'
The regression equation is
Correlations:
Sales, Harga, Iklan
Harga
Iklan
Sales
-0.863
0.001
0.891
0.001
Harga
-0.654
0.040
Cell Contents:
Pearson correlation
P-Value
Sales = 16.4 - 8.25 Harga + 0.585 Iklan
Predictor
Constant
Harga
Iklan
Coef
16.406
-8.248
0.5851
SE Coef
4.343
2.196
0.1337
S = 1.507
R-Sq = 93.2%
T
3.78
-3.76
4.38
P
0.007
0.007
0.003
R-Sq(adj) = 91.2%
Analysis of Variance
Source
DF
Regression 2
Residual
7
Total
9
SS
217.70
15.90
233.60
MS
108.85
2.27
F
P
47.92 0.000
Problem 2: MINITAB output …
R2 = 74.6%
R2 = 79.5%
(continued)
R2 = 93.2%
Problem 3: Regresi dengan Variabel Dummy
Bagaimana pengaruh TES
BAKAT dan GENDER thd
produktifitas ? Dapatkah
produktifitas pekerja
diramal dari tes bakat dan
jenis kelaminnya?
F1 , F2 , …, Fq
Process
Input (X)
Nilai
TES BAKAT
pekerja
Controllable Factors
(Model Regresi)
JENIS
KELAMIN
pekerja
Z1 , Z2 , …, Zq
Uncontrollable Factors
Emosi ( suasana hati) pekerja dan faktor lain
yang tidak dapat dikontrol dalam kondisi TETAP
Usia, Pendidikan,
Ruang kerja, Mesin
dan faktor faktor lain
yang dapat dikontrol
dalam kondisi TETAP
Output (Y)
Produktifitas
pekerja
Problem 2: Data hasil pengamatan …
Pengamatan dilakukan dengan mengambil
secara random data 15 pekerja
(continued)
Plot antara Tes Bakat dan Produktifitas, antara pekerja PRI A dan
WANI TA
Problem 3: MINITAB output …
MTB > Correlation
(continued)
'Tes Bakat' 'Dummy' 'Produktifitas'.
Produktifitas
Tes Bakat
0.876
0.000
Dummy
-0.021
0.940
MTB > Regress 'Produktifitas' 2 'Tes Bakat' 'Dummy'
The regression equation is
Produktifitas = - 4.14 + 0.120 Tes Bakat + 2.18 Dummy
Predictor
Constant
Tes Bakat
Dummy
S = 0.7863
Coef
-4.1372
0.12041
2.1807
SE Coef
0.8936
0.01015
0.4503
R-Sq = 92.1%
T
-4.63
11.86
4.84
P
0.001
0.000
0.000
R-Sq(adj) = 90.8%
Problem 3: MINITAB output …
(continued)
Problem 3: Plot hasil regresi …
(continued)
WANI TA
PRI A
Model-model Time Series Regression
1. Model Regresi untuk LI NEAR TREND
Yt = a + b.t + error
Ö t = 1, 2, … ( dummy w aktu)
2. Model Regresi untuk Data SEASONAL ( variasi konstan)
Yt = a + b1 D 1 + … + bS-1 D S-1 + error
dengan : D 1 , D 2 , …, D S-1 adalah dummy w aktu dalam
satu periode seasonal.
3. Model Regresi untuk Data dengan LI NEAR TREND dan
SEASONAL ( variasi konstan)
Yt = a + b.t + c1 D 1 + … + cS-1 D S-1 + error
 Gabungan model 1 dan 2.
Problem 4: Regresi Trend Linear
(Video Store case)
Time Series Plot data Sales
Problem 4: Hasil Regresi Trend dg MINITAB …
(continued)
Problem 4: Hasil Regresi Trend dg MINITAB …
(continued)
Problem 5: Regresi Data Seasonal …
(Data Electrical Usage)
Time Series Plot
( Data seasonal)
Problem 5: Hasil regresi dengan MINITAB …
MTB > Regress 'Kilowatts' 3 'Kuartal-1'-'Kuartal-3'
The regression equation is
Kilowatts = 722 + 281 Kuartal.1 - 97.4 Kuartal.2 - 202 Kuartal.3
Predictor
Constant
Kuartal.1
Kuartal.2
Kuartal.3
S = 30.84
Coef
721.60
281.20
-97.40
-202.20
SE Coef
13.79
19.51
19.51
19.51
R-Sq = 97.7%
Analysis of Variance
Source
DF
Regression
3
Residual Error
16
Total
19
SS
646802
15220
662022
T
52.32
14.42
-4.99
-10.37
P
0.000
0.000
0.000
0.000
R-Sq(adj) = 97.3%
MS
215601
951
F
226.65
P
0.000
Problem 5: Struktur dummy dan hasil regresinya …
Dummy Variable
Problem 5: Hasil regresi dengan MINITAB …
Forecast
Time Series Plot
( Data dan Ramalannya)
Problem 6: Regresi Data Trend Linear dan Seasonal …
Time Series Plot
( Data trend dan seasonal)
Problem 6: Hasil regresi dengan MINITAB …
Dummy Variable
Problem 6: Hasil regresi dengan MINITAB …
MTB > Regress 'Sales' 4 't' 'Kuartal.1'-'Kuartal.3'
The regression equation is
Sales = 413 + 19.7 t + 130 Kuartal.1 - 108 Kuartal.2 - 228 Kuartal.3
16 cases used 4 cases contain missing values
Predictor
Constant
t
Kuartal.1
Kuartal.2
Kuartal.3
S = 35.98
Coef
412.81
19.719
130.41
-108.06
-227.78
SE Coef
26.99
2.012
26.15
25.76
25.52
R-Sq = 96.3%
T
15.30
9.80
4.99
-4.19
-8.92
P
0.000
0.000
0.000
0.001
0.000
R-Sq(adj) = 95.0%
Analysis of Variance
Source
Regression
Residual Error
Total
DF
4
11
15
SS
371967
14243
386211
MS
92992
1295
F
71.82
P
0.000
Problem 6: Hasil regresi dengan MINITAB …
Forecast
Time Series Plot
( Data dan Ramalannya)
Perbandingan ketepatan ramalan antar metode …
Kasus Sales Video Store
Model
Kasus Sales Data Kuartalan
Kriteria kesalahan ramalan
MSE
MAD
MAPE
Double
M.A.
66.6963
6.68889
0.9557
Holt’s
Method
28.7083
4.4236
0.6382
Regresi
Trend
21.6829
3.73048
0.5382
Holt’s Method :
Alpha (level): 0.202284
Gamma (trend): 0.234940
Kriteria kesalahan ramalan
Model
MSE
MAD
MAPE
Winter’s
Method
4372.69
52.29
9.67
Regresi
Trend &
Seasonal
890.215
23.2969
4.3122
Winter’s Method :
Alpha (level): 0.4
Gamma (trend): 0.1
Delta (seasonal): 0.3
Tugas : Carilah model peramalan terbaik untuk dua
data sales (produk A dan B) berikut ini.