Analisis Deret Waktu
Pertemuan 2
FMA, PKS. Dept. Statistika IPB
Jenis Data
•
Cross section
¾ Beberapa pengamatan diamati bersama‐sama pada periode waktu tertentup p g p p ¾ Harga saham semua perusahaan yang tercatat di BEJ pada hari Rabu 27 Februari 2008•
Time Series
¾ Satu pengamatan diamati selama sekian periode secara teratur ¾ Harga saham P.T. TELKOM di BEJ dari 2 Januari 2008 hingga 27 Februari 2008•
Longitudinal/panel
¾ Beberapa pengamatan diamati bersama‐sama selama kurun waktu tertentu p p g (gabungan cross section dan time series) ¾ Harga saham P.T. TELKOM, P.T. INDOSAT, dan P.T. Mobile8 di BEJ dari 2 Januari 2008 hingga 27 Februari 2008Pola Data Time Series
5 6 7 8 9 30 35 40 45 50 0 1 2 3 4 5 12345678910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 0 5 10 15 20 25 12345678910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 14 16 18 20 25 Konstan TrendFMA, PKS. Dept. Statistika IPB
0 2 4 6 8 10 12 12345678910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 0 5 10 15 12345678910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Seasonal Cyclic
Metode Forecasting
Metode forecasting dapat dibedakan menjadi
dua kelompok:
dua kelompok:
•Smoothing
¾Moving average, Single Exponential Smoothing,
Double Exponential Smoothing, Metode Winter
•Modeling
¾
/
¾ARIMA, ARCH/GARCH
Year 2000 ??
FMA, PKS. Dept. Statistika IPB
Smoothing
Sekilas Tentang Smoothing
•
Prinsip dasar: pengenalan pola data dengan
h l k
i i l k l
menghaluskan variasi lokal.
•
Prinsip penghalusan umumnya berupa rata‐
rata.
•
Beberapa metode penghalusan hanya cocok
untuk pola data tertentu
untuk pola data tertentu.
FMA, PKS. Dept. Statistika IPB
Metode Yang Dibahas
•
Single Moving Average
•
Double Moving Average
•
Single Exponential Smoothing
•
Double Exponential Smoothing
•
Metode Winter untuk musiman aditif
•
Metode Winter untuk musiman multiplikatif
Ilustrasi
• All these methods will be illustrated with the following example: Suppose that a hospital would like to forecast the number of patients arrival from the following historical p g data:
Week Patients Arrival
1 400
2 380
3 411
4 415
• Note: Although week 4 data is given, some methods require that forecast for period 4 is first computed before computing forecast for period 5.
web4.uwindsor.ca/users/b/.../73.../Lecture_5_Forecasting_f04_331.ppt
Time Series Methods Simple Moving Average
450
A moving average of order N is simply the arithmetic average of the most recent N
observations For 3 week moving averages N=3; 450 —
430 —
410 —
390 —
ent arrivals
observations. For 3-week moving averages N=3; for 6-week moving averages N=6; etc.
Week 370 — Pati | | | | | | 0 5 10 15 20 25 30 Actual patient arrivals
450 Patient
Time Series Methods Simple Moving Average
450 — 430 — 410 — 390 — ent arrivals Patient Week Arrivals 1 400 2 380 3 411
Given 3-week data, one-step-ahead forecast for week 4 or two step ahead forecast for 370 —
Pati
Week
| | | | | |
0 5 10 15 20 25 30
for week 4 or two-step-ahead forecast for week 5 is simply the arithmetic average of the first 3-week data
450 Patient
Time Series Methods Simple Moving Average
4 f k forecast ahead -step -One 450 — 430 — 410 — 390 — ent arrivals at e t Week Arrivals 1 400 2 380 3 411 = 4 F 4 for week 370 — Pati Week | | | | | | 0 5 10 15 20 25 30
450
Time Series Methods Simple Moving Average
Patient 450 — 430 — 410 — 390 — ent arrivals Patient Week Arrivals 1 400 2 380 3 411 5 f k forecast ahead -step -Two 370 — Pati | | | | | | 0 5 10 15 20 25 30 Week 5 for week = 5 F 450 Patient
Time Series Methods Simple Moving Average
One-step-ahead forecast for week 5 is computed from the arithmetic average of weeks 2, 3 and 4 data 450 — 430 — 410 — 390 — ent arrivals at e t Week Arrivals 2 380 3 411 4 415 5 f k forecast ahead -step -One data 370 — Pati Week | | | | | | 0 5 10 15 20 25 30 5 for week = 5 F
450 3 k MA
Time Series Methods Simple Moving Average
450 — 430 — 410 — 390 — ent arrivals 3-week MA forecast 370 — Pati Week | | | | | | 0 5 10 15 20 25 30 Actual patient arrivals 450 3 k MA 6-week MA
Time Series Methods Simple Moving Average
450 — 430 — 410 — 390 — ent arrivals 3-week MA forecast 6-week MA forecast Week 370 — Pati | | | | | | 0 5 10 15 20 25 30 Actual patient arrivals
FMA, PKS. Dept. Statistika IPB
Single Moving Average
y Ide: data pada suatu periode dipengaruhi oleh data
beberapa periode sebelumnya
beberapa periode sebelumnya
y Cocok untuk pola data konstan/stasioner
y Prinsip dasar:
¾ Data smoothing pada periode ke‐t merupakan rata‐rata dari m buah data dari data periode ke‐t hingga ke‐(t‐
m+1) Î 1 t
t i
S =
∑
X¾ Data smoothing pada periode ke‐t berperan sebagai nilai
forecasting pada periode ke‐t+1 Ft= St‐1dan Fn,h= Sn
1
t i
i t m m = − +
∑
Ilustrasi MA dengan m=3
Periode (t) Data (Xt) Smoothing (St) Forecasting (Ft)
1 5 - -2 7 - -2 7 - -3 6 6 -4 4 5.6 6 5 5 5 5.6 6 6 5 5 7 8 6.3 5 8 7 7 6 3 8 7 7 6.3 9 8 7.6 7 10 7 7.3 7.6 11 7.3 12 7.3
Pengaruh Pemilihan Nilai m
8.00 9.00 2.00 3.00 4.00 5.00 6.00 7.00 Semula MA (m=3) MA (m=6)FMA, PKS. Dept. Statistika IPB
0.00 1.00
1 23 4 5 67 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Waktu
MA dengan m yang lebih besar menghasilkan pola data yang lebih halus.
Example: Weekly Department Store Sales
• The weekly sales figures (in
millions of dollars)
d i
h f ll
i
Period (t) Sales (y)
1 5,3
2 4,4
3 5,4
4 5,8
5 5,6
presented in the following
table are used by a major
department store to
determine the need for
temporary sales personnel.
5 5,6 6 4,8 7 5,6 8 5,6 9 5,4 10 6,5 11 5,1 12 5,8 13 5 14 6,2 15 5,6 16 6,7 17 5,2 18 5,5 19 5,8 20 5,1 21 5,8 22 6,7 23 5,2 24 6 25 5,8
Example: Weekly Department Store Sales
Weekly Sales 8 2 3 4 5 6 7 8 Sa le s Sales (y) 0 1 2 0 5 10 15 20 25 30 Weeks
Example: Weekly Department Store Sales
• Use a three-week moving average (k=3) for
th d
t
t t
l
t f
t f
th
the department store sales to forecast for the
week 24 and 26.
• The forecast error is
9 . 5 3 8 . 5 7 . 6 2 . 5 3 ) ( ˆ 23 22 21 24 = + + = + + = y y y y 1 . 9 . 5 6 ˆ24 24 24=y −y = − = e
Example: Weekly Department Store Sales
• The forecast for the week 26 is
7 . 5 3 2 . 5 6 8 . 5 3 ˆ 25 24 23 26 = + + = + + =y y y y
Latihan: Weekly Department Store Sales
Period (t) Sales (y) forecast 1 5.3 • RMSE = 0.63 2 4.4 3 5.4 4 5.8 5.033333 5 5.6 5.2 6 4.8 5.6 7 5.6 5.4 8 5.6 5.333333 9 5.4 5.333333 10 6.5 5.533333 11 5.1 5.833333 12 5.8 5.666667 13 5 5.8 14 6.2 5.3 15 5.6 5.666667 16 6.7 5.6 RMSE 0.63
Weekly Sales Forecasts
3 4 5 6 7 8 Sal e s Sales (y) forecast 17 5.2 6.166667 18 5.5 5.833333 19 5.8 5.8 20 5.1 5.5 21 5.8 5.466667 22 6.7 5.566667 23 5.2 5.866667 24 6 5.9 25 5.8 5.966667 5.666667 0 1 2 3 0 5 10 15 20 25 30 Weeks faculty.wiu.edu/F-Dehkordi/DS-533/.../Moving-average-methods.ppt
Double Moving Average
•
Mirip dengan single moving average
•
Mirip dengan single moving average
•
Cocok untuk data yang berpola tren
•
Proses penghalusan dengan rata‐rata
dilakukan dua kali
– Tahap I: 1 t S =∑
X p – Tahap II: 1, 1 t i i t m S X m = − + =∑
2, 1, 1 1 t t i i t m S S m= − + =∑
Double Moving Average
(lanjutan)•
Forecasting dilakukan dengan formula
•
Forecasting dilakukan dengan formula
dengan
2, ,t t h t t( ) F + = A +B h 1, 2,2
t t tA
=
S
−
S
FMA, PKS. Dept. Statistika IPB
(
1, 2,)
2 1 t t t B S S m = − −Ilustrasi DMA dengan m=3
t Xt S1,t S2,t At Bt F2,t 1 12.50 2 11.80 3 12.85 12.38 4 13.95 12.87 5 13.30 13.37 12.87 13.87 0.50 6 13.95 13.73 13.32 14.14 0.41 14.37 7 15.00 14.08 13.73 14.43 0.35 14.55 8 16.20 15.05 14.29 15.81 0.76 14.78 8 16.20 15.05 14.29 15.81 0.76 14.78 9 16.10 15.77 14.97 16.57 0.80 16.57 10 17.37 11 18.17 12 18.97Pemilihan Model
(lanjutan)
8 9 3 4 5 6 7 8 Semula MA(m=3) MA(m=6) SES(0.3) SES(0.4)FMA, PKS. Dept. Statistika IPB
0 1 2 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Waktu