16/02/2016
1
Analisis Deret WaktuAnalisis Deret Waktu
Pertemuan 2
PKS. Dept. Statistika IPB
16/02/2016
2
• Apa yang dimaksud dengan pemulusanApa yang dimaksud dengan pemulusan (smoothing) dalam analisis data deret waktu)?
• Sebutkan macam2 metode pemulusan yang• Sebutkan macam2 metode pemulusan yang anda ketahui !
FMA, PKS. Dept. Statistika IPB
16/02/2016
3
Why Smoothing?Why Smoothing?
Standard task Data fitting a ModelStandard task Data fitting a Modelestimation of parameters requires 2 steps:• identification of a suitable model• identification of a suitable model, • checking to see if the fitted model adequately fi h dfits the data,
Parametric models can be flexible, but they will not adequately fit all data sets.
FMA, PKS. Dept. Statistika IPB
16/02/2016
4
Alternative??Alternative??
model tidak ditulis secara eksplisit dalam halmodel tidak ditulis secara eksplisit dalam halparameter; fleksibel untuk berbagai situasi.
• menghasilkan plot yang lebih mulus untuk membantu pemahaman;
• mengidentifikasi model parametrik yang sesuai dari bentuk data pemulusan;data pemulusan;
• menghilangkan efek yang kompleks yang bukan perhatian utama sehingga perhatian difokuskan pada efek yang menarik untuk dibahas;
• memberikan data diinterpolasi lebih tepat untuk perhitungan selanjutnyaselanjutnya
FMA, PKS. Dept. Statistika IPB
16/02/2016
5
SmootherSmoother
• A smoother fits a smooth curve through dataA smoother fits a smooth curve through data, the fit is called the smooth (the signal), the residuals the rough: Data=Smooth+Roughresiduals the rough: Data=Smooth+Rough
• Sinyal diasumsikan bervariasi dengan mulus di sebagian besar• Sinyal diasumsikan bervariasi dengan mulus di sebagian besar waktu, mungkin dengan beberapa perubahan mendadak.
• The Rough dapat dianggap sebagai jumlah dari noise aditif g p gg p g jyang menyebar simetris dengan mean nol dan ragam tertentu, dan impulsif(tiba‐tiba berubah), outlier.
FMA, PKS. Dept. Statistika IPB
16/02/2016
6
Jenis DataJenis Data
• Cross sectionBeberapa pengamatan diamati bersama‐sama pada periode waktu tertentuHarga saham semua perusahaan yang tercatat di BEJ pada hari Rabu 27 Februari 2008
i S i• Time SeriesSatu pengamatan diamati selama sekian periode secara teraturHarga saham P.T. TELKOM di BEJ dari 2 Januari 2008 hingga 27 Februari 2008
• Longitudinal/panelBeberapa pengamatan diamati bersama‐sama selama kurun waktu tertentu (gabungan cross section dan time series)
h d bil di d i iHarga saham P.T. TELKOM, P.T. INDOSAT, dan P.T. Mobile8 di BEJ dari 2 Januari 2008 hingga 27 Februari 2008
FMA, PKS. Dept. Statistika IPB
16/02/2016
7
Pola Data Time Series
7
8
9
40
45
50
3
4
5
6
15
20
25
30
35
0
1
2
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 0
5
10
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
18
Konstan Trend
12
14
16
18
20
25
4
6
8
10
5
10
15
FMA, PKS. Dept. Statistika IPB
0
2
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 360
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
Seasonal Cyclic
16/02/2016
8
Metode ForecastingMetode Forecasting
Metode forecasting dapat dibedakan menjadiMetode forecasting dapat dibedakan menjadi dua kelompok:•SmoothingSmoothing
Moving average, Single Exponential Smoothing, Double Exponential Smoothing, Metode Winter
•ModelingARIMA, ARCH/GARCH
FMA, PKS. Dept. Statistika IPB
16/02/2016
9
Year 2000 ??
FMA, PKS. Dept. Statistika IPB
16/02/2016
10
Pemulusan (Smoothing)Pemulusan (Smoothing)
FMA, PKS. Dept. Statistika IPB
16/02/2016
11
Sekilas Tentang SmoothingSekilas Tentang Smoothing
• Prinsip dasar: pengenalan p p gpola data dengan memuluskan variasi lokal.P i i l• Prinsip pemulusanumumnya berupa rata‐rata.
• Beberapa metode ppemulusan hanya cocok untuk pola data tertentu.
FMA, PKS. Dept. Statistika IPB
16/02/2016
12
Metode Yang DibahasMetode Yang Dibahas
• Single Moving AverageSingle Moving Average• Double Moving AverageSi l i l S hi• Single Exponential Smoothing
• Double Exponential Smoothing• Metode Winter untuk musiman aditif• Metode Winter untuk musiman multiplikatifMetode Winter untuk musiman multiplikatif
FMA, PKS. Dept. Statistika IPB
16/02/2016
13
Ilustrasi
• All these methods will be illustrated with the following example: Suppose that a hospital would like to forecast p pp pthe number of patients arrival from the following historical data:Week Patients ArrivalWeek Patients Arrival
1 4002 3802 3803 4114 415
• Note: Although week 4 data is given, some methods require that forecast for period 4 is first computed before computing forecast for period 5computing forecast for period 5.
web4.uwindsor.ca/users/b/.../73.../Lecture_5_Forecasting_f04_331.ppt
16/02/2016
14
Time Series MethodsSimple Moving AverageSimple Moving Average
MA(N) merupakan rata-rata aritmetika dari N observasi terdekat Untuk MA 3-minggu N=3
450 —
430 —
observasi terdekat. Untuk MA 3-minggu N=3Untuk MA 3-minggu N=6; etc.
430 —
410 —
rival
s
390 —
370 —
Patie
nt a
rrP
| | | | | |0 5 10 15 20 25 30
Data kedatangan pasien aktual
Week0 5 10 15 20 25 30
16/02/2016
15
Time Series MethodsSimple Moving AverageSimple Moving Average
450 —
430 —
PatientWeek Arrivals
1 400430 —
410 —
rival
s
2 3803 411
390 —
370 —
Patie
nt a
rr
Given 3-week data, one-step-ahead forecast for week 4 or two-step-ahead forecast for week 5 is simply the arithmetic average ofP
| | | | | |0 5 10 15 20 25 30
week 5 is simply the arithmetic average of the first 3-week data
Week0 5 10 15 20 25 30
16/02/2016
16
Time Series MethodsSimple Moving AverageSimple Moving Average
450 —
430 —
PatientWeek Arrivals
1 400430 —
410 —
rival
s
2 3803 411
4for week forecast ahead-step-One390 —
370 —
Patie
nt a
rr
=4F
P
| | | | | |0 5 10 15 20 25 30
Week0 5 10 15 20 25 30
16/02/2016
17
Time Series MethodsSimple Moving AverageSimple Moving Average
450 —
430 —
PatientWeek Arrivals
1 400430 —
410 —
rival
s
2 3803 411
390 —
370 —
Patie
nt a
rr
5for week forecast ahead-step-Two
P
| | | | | |0 5 10 15 20 25 30
=5F
0 5 10 15 20 25 30Week
16/02/2016
18
Time Series MethodsSimple Moving AverageSimple Moving Average
One-step-ahead forecast for week 5 is computed from the arithmetic average of weeks 2, 3 and 4
450 —
430 —
PatientWeek Arrivals
2 380
g ,data
430 —
410 —
rival
s
3 4114 415
390 —
370 —
Patie
nt a
rr
5for week forecast ahead-step-One
P
| | | | | |0 5 10 15 20 25 30
=5F
Week0 5 10 15 20 25 30
16/02/2016
19
Time Series MethodsSimple Moving AverageSimple Moving Average
450 —
430 —
3-week MAforecast
430 —
410 —
rival
s
390 —
370 —
Patie
nt a
rr
Actual patientP
| | | | | |0 5 10 15 20 25 30
parrivals
Week0 5 10 15 20 25 30
16/02/2016
20
Time Series MethodsSimple Moving AverageSimple Moving Average
450 —
430 —
3-week MAforecast
6-week MAforecast
430 —
410 —
rival
s
390 —
370 —
Patie
nt a
rr
Actual patientP
| | | | | |0 5 10 15 20 25 30
parrivals
Week0 5 10 15 20 25 30
16/02/2016
21
FMA, PKS. Dept. Statistika IPB
16/02/2016
22
Single Moving Averageg g g
Ide: data pada suatu periode dipengaruhi oleh dataIde: data pada suatu periode dipengaruhi oleh data beberapa periode sebelumnyaCocok untuk pola data konstan/stasionerPrinsip dasar:
Data smoothing pada periode ke‐tmerupakan rata‐rata darim buah data dari data periode ke t hingga ke (tdarim buah data dari data periode ke‐t hingga ke‐(t‐m+1)
1
1 t
t ii t m
S Xm = − +
= ∑Data smoothing pada periode ke‐t berperan sebagai nilaiforecasting pada periode ke‐t+1
Ft = St 1 dan F h = SFt St‐1 dan Fn,h Sn
FMA, PKS. Dept. Statistika IPB
16/02/2016
23
Ilustrasi MA dengan m=3Periode (t) Data (Xt) Smoothing (St) Forecasting (Ft)
1 5 - -5 7 6 6S + +52 7 - -3 6 6 -
5 7 63 3 6S + += =
4 4 5.6 65 5 5 5.66 6 5 5 4 3F S=6 6 5 57 8 6.3 58 7 7 6.39 8 7.6 7
10 7 7.3 7.611 7 311 7.312 7.3
16/02/2016
24
Pengaruh Pemilihan NilaimPengaruh Pemilihan Nilai m9.00
6.00
7.00
8.00
3 00
4.00
5.00 SemulaMA (m=3)MA (m=6)
1.00
2.00
3.00
0.001 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
MA dengan m yang lebih besar menghasilkan pola data yang lebih
FMA, PKS. Dept. Statistika IPB
g y g g p y ghalus.
16/02/2016
25
Example: Weekly Department Store Sales
• The weekly sales figures (in millions of dollars)
Period (t) Sales (y)1 5,32 4,43 5,4millions of dollars)
presented in the following table are used by a major
4 5,85 5,66 4,87 5,68 5,6table are used by a major
department store to determine the need for
9 5,410 6,511 5,112 5,813 5
temporary sales personnel.13 514 6,215 5,616 6,717 5,218 5 518 5,519 5,820 5,121 5,822 6,723 5 223 5,224 625 5,8
16/02/2016
26
Example: Weekly Department Store SalesExample: Weekly Department Store Sales
Weekly Sales
8
6
7
8
4
5
Sale
s
Sales (y)
1
2
3
00 5 10 15 20 25 30
Weeks
16/02/2016
27
Example: Weekly Department Store SalesExample: Weekly Department Store Sales
• Use a three-week moving average (k=3) forUse a three-week moving average (k 3) for the department store sales to forecast for the week 24 and 26week 24 and 26.
Th f i
9.53
8.57.62.53
)(ˆ 21222324 =
++=
++=
yyyy
• The forecast error is
ˆ 1.9.56ˆ242424 =−=−= yye
16/02/2016
28
Example: Weekly Department Store SalesExample: Weekly Department Store Sales
• The forecast for the week 26 isThe forecast for the week 26 is
7.53
2.568.53
ˆ 23242526 =
++=
++=
yyyy33
16/02/2016
29
Latihan: WeeklyPeriod (t) Sales (y) forecast
1 5.32 4 4Latihan: Weekly
Department Store Sales2 4.43 5.44 5.8 5.033335 5.6 5.26 4.8 5.67 5.6 5.48 5.6 5.333339 5.4 5.3333310 6.5 5.5333311 5 1 5 83333
• RMSE = 0.63Weekly Sales Forecasts
8 11 5.1 5.8333312 5.8 5.6666713 5 5.814 6.2 5.315 5.6 5.66667
5
6
7
8
16 6.7 5.617 5.2 6.1666718 5.5 5.8333319 5.8 5.820 5 1 5 5
3
4
5
Sale
s Sales (y)
forecast
20 5.1 5.521 5.8 5.4666722 6.7 5.5666723 5.2 5.8666724 6 5.9
0
1
2
0 5 10 15 20 25 30
Weeks 24 6 5.925 5.8 5.96667
5.66667
faculty.wiu.edu/F-Dehkordi/DS-533/.../Moving-average-methods.ppt
16/02/2016
30
Double Moving Averageg g
• Mirip dengan single moving average• Cocok untuk data yang berpola trenCocok untuk data yang berpola tren• Proses pemulusan dengan rata‐rata dilakukan dua kalidua kali– Tahap I:
1,1
1 t
t ii t m
S Xm = − +
= ∑
– Tahap II:2, 1,
1
1 t
t ii t m
S Sm = − +
= ∑
FMA, PKS. Dept. Statistika IPB
16/02/2016
31
Double Moving Average (lanjutan)g g ( j )
• Forecasting dilakukan dengan formula
d
2, , ( )t t h t tF A B h+ = +
dengan
1 22t t tA S S= −1, 2,t t t
( )1, 2,2
1t t tB S Sm
= −−
FMA, PKS. Dept. Statistika IPB
16/02/2016
32
Ilustrasi DMA dengan m=3gt 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
12.5 11.8 12.85(1)3 3 12.38S + += =
12.87 13.32 13.73( ) 12 87S + += =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
(2)3 3 12.87S = =
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
9 16 10 15 77 14 97 16 57 0 80 16 579 16.10 15.77 14.97 16.57 0.80 16.57
10 17.37
11 18.17
12 18.97FMA, PKS. Dept. Statistika IPB
16/02/2016
33
Pemilihan Model (lanjutan)
9
7
8
5
6
SemulaMA(m=3)MA(m=6)
3
4
MA(m 6)SES(0.3)SES(0.4)
0
1
2
FMA, PKS. Dept. Statistika IPB
01 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
Top Related