Analisis Deret Waktu Pertemuan 2 PKS. Dept. Statistika IPB 1
Apayang dimaksud dengan pemulusan (smoothing) dalam analisis data deret waktu)? Sebutkan macam2 metode pemulusan yang anda ketahui! 2
Why Smoothing? Standard task Data fitting a Model estimation of parameters requires 2 steps: identification of a suitable model, checking to see if the fitted model adequately fits the data, Parametric models can be flexible, but they will not adequately fit all data sets. 3
Alternative?? model tidak ditulis secaraeksplisit dalam hal parameter; fleksibel untuk berbagai situasi. menghasilkan plot yang lebih mulus untuk membantu pemahaman; mengidentifikasi model parametrik yang sesuai dari bentuk 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 selanjutnya 4
Smoother A smoother fits a smooth curve through data, the fit is called the smooth (the signal), the residuals the rough: Data=Smooth+Rough Sinyaldiasumsikan bervariasi dengan mulus di sebagianbesarbesar waktu, mungkin dengan beberapa perubahan mendadak. The Rough dapat dianggap sebagai jumlah dari noise aditif yang menyebar simetris dengan mean nol dan ragam tertentu, dan impulsif(tiba tiba berubah), outlier. 5
Jenis Data Cross section Beberapa pengamatan diamati bersama sama pada periode waktu tertentu 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 (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 2008 6
Pola Data Time Series 9 50 8 45 7 40 35 6 30 5 25 4 20 3 15 2 10 1 5 0 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 Konstan 0 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 Trend 18 25 16 14 20 12 10 15 8 10 6 4 5 2 0 0 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 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 7
Metode Forecasting Metode forecasting dapat dibedakan menjadi dua kelompok: Smoothing Moving average, Single Exponential Smoothing, Double Exponential Smoothing, Metode Winter Modeling ARIMA, ARCH/GARCH 8
Year 2000?? 9
Pemulusan (Smoothing) 10
Sekilas Tentang Smoothing Prinsip dasar: pengenalan pola data dengan memuluskan variasi lokal. Pi Prinsip i pemulusan umumnya berupa rata rata. Beberapa metode pemulusan hanya cocok untuk pola data tertentu. 11
Metode Yang Dibahas Single Moving Average Double Moving Average Single Exponential ilsmoothing Double Exponential Smoothing Metode Winter untuk musiman aditif Metode Winter untuk musiman multiplikatif 12
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 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 13
Time Series Methods Simple Moving Average 450 MA(N) merupakan rata-rata aritmetika dari N observasi terdekat. Untuk MA 3-minggu N=3 Untuk MA 3-minggu N=6; etc. 430 Patient arr rivals 410 390 370 Data kedatangan pasien aktual 0 5 10 15 20 25 30 Week 14
Time Series Methods Simple Moving Average Patient arr rivals 450 430 410 390 370 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 week 5 is simply the arithmetic average of the first 3-week data 0 5 10 15 20 25 30 Week 15
Time Series Methods Simple Moving Average Patient arr rivals 450 430 410 390 370 Patient Week Arrivals 1 400 2 380 3 411 One -step - ahead forecast for week 4 = F 4 0 5 10 15 20 25 30 Week 16
Time Series Methods Simple Moving Average Patient arr rivals 450 430 410 390 370 Patient Week Arrivals 1 400 2 380 3 411 Two -step - ahead forecast for week 5 F 5 0 5 10 15 20 25 30 Week = 17
Time Series Methods Simple Moving Average Patient arr rivals 450 430 410 390 370 One-step-ahead forecast for week 5 is computed from the arithmetic average of weeks 2, 3 and 4 data Patient Week Arrivals 2 380 3 411 4 415 One -step - ahead forecast for week 5 F 5 0 5 10 15 20 25 30 Week = 18
Time Series Methods Simple Moving Average Patient arr rivals 450 430 410 390 370 3-week MA forecast Actual patient arrivals 0 5 10 15 20 25 30 Week 19
Time Series Methods Simple Moving Average 450 430 3-week MA forecast 6-week MA forecast Patient arr rivals 410 390 370 Actual patient arrivals 0 5 10 15 20 25 30 Week 20
21
Single Moving Average Ide: data pada suatu periode dipengaruhi oleh data beberapa periode sebelumnya Cocok untuk pola data konstan/stasioner Prinsip dasar: Data smoothing pada periode ke t merupakan rata rata dari m buah data dari data periode ke tt hingga ke (t t m+1) 1 St = Xi m i = t m + 1 Data smoothing pada periode ke t berperan sebagai nilai forecasting pada periode ke t+1 F t = S t 11 dan F n,h = S n 22
Ilustrasi MA dengan m=3 Periode (t) Data (X t ) Smoothing (S t ) Forecasting (F t ) 1 5-5 + - 7 + 6 S 2 7-3 = -3 = 6 3 6 6-4 4 5.6 6 5 5 5 5.6 F 4 = S 6 6 5 5 3 7 8 6.3 5 8 7 7 6.3 9 8 7.6 7 10 7 7.3 7.6 11 73 7.3 12 7.3 23
Pengaruh Pemilihan Nilai m 9.00 8.00 7.00 6.00 5.00 Semula MA (m=3) 4.00 MA (m=6) 300 3.00 2.00 1.00 0.00 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 MA dengan m yang lebih besar menghasilkan pola data yang lebih halus. 24
Example: Weekly Department Store Sales The weekly sales figures (in millions of dollars) presented in the following table are used by a major department store to determine the need for temporary sales personnel. Period (t) Sales (y) 1 5,3 2 4,4 3 5,4 4 5,8 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 55 5,5 19 5,8 20 5,1 21 5,8 22 6,7 23 52 5,2 24 6 25 5,8 25
Example: Weekly Department Store Sales Weekly Sales 8 7 6 5 Sales 4 Sales (y) 3 2 1 0 0 5 10 15 20 25 30 Weeks 26
Example: Weekly Department Store Sales Use a three-week moving average (k=3) for the department store sales to forecast for the week 24 and 26. ( y = + y 3 The forecast error is + y ) 5.2 + 6.7 + 5.8 = 3 23 22 21 yˆ 24 = 5.9 e = y yˆ = 6 5.9. 1 24 24 ˆ24 = 27
Example: Weekly Department Store Sales The forecast for the week 26 is y + y + y 3 5.8 + 6 + 5.2 = 3 25 24 23 yˆ 26 = = 5.7 28
Period (t) Sales (y) forecast 1 5.3 2 44 4.4 3 5.4 4 5.8 5.03333 5 5.6 5.2 6 4.8 5.6 7 5.6 5.4 RMSE = 0.63 8 5.6 5.33333 9 5.4 5.33333 Weekly Sales Forecasts 10 6.5 5.53333 8 11 51 5.1 5.83333 7 12 5.8 5.66667 13 5 5.8 6 14 6.2 5.3 15 5.6 5.66667 Latihan: Weekly Department Store Sales Sales 5 4 3 2 1 0 0 5 10 15 20 25 30 Sales (y) forecast 16 6.7 5.6 17 5.2 6.16667 18 5.5 5.83333 19 5.8 5.8 20 51 5.1 55 5.5 21 5.8 5.46667 22 6.7 5.56667 23 5.2 5.86667 Weeks 24 6 5.9 25 5.8 5.96667 5.66667 faculty.wiu.edu/f-dehkordi/ds-533/.../moving-average-methods.ppt 29
Double Moving Average Mirip dengan single moving average Cocok untuk data yang berpola tren Proses pemulusan dengan rata rata dilakukan dua kali Tahap I: S 1, t t 1 m i = t m + 1 = t 1 m i = t m + 1 Tahap II: S2, t S1, = X i i 30
Double Moving Average (lanjutan) Forecasting dilakukan dengan formula dengan F2, tt, + h= At + Bt( h) A = 2S S t 1, t 2, t 2 B = S S m 1 ( 1, 2, ) t t t 31
Ilustrasi DMA dengan m=3 t X t S 1,t S 2,t A t B t F 2,t 1 12.50 2 11.80 3 12.85 12.38 4 13.95 12.87 12.5+ 11.8+ 12.85 S (1)3 = 3 = 12.38 5 13.30 13.37 12.87 13.87 0.50 12.87+ 13.32+ 13.73 S (2)3 = 3 = 12.87 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 9 16.1010 15.77 14.97 16.57 080 0.80 16.57 10 17.37 11 18.17 12 18.97 32
Pemilihan Model (lanjutan) 9 8 7 6 5 4 3 Semula MA(m=3) MA(m=6) SES(0.3) SES(0.4) 2 1 0 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 33