47
Kuliah 2 | Metode Peramalan Deret Waktu [email protected]

Kuliah 2 | Metode Peramalan Deret Waktu rahmaanisa@apps ... series...Jun 2 5.8 7.4 Jul 1 4.2 5.8 Aug 0 2.6 4.2 Sep 1 1.4 2.6 Oct 5 1.8 1.4 Nov 12 3.8 1.8 Dec 14 6.4 3.8 Forecast 6.4

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

  • Kuliah 2 | Metode Peramalan Deret Waktu

    [email protected]

  • REVIEW Tentukan pola dari data deret waktu berikut:

    Gambar (1) Gambar (2)

    Gambar (3) Gambar (4)

    2

  • Kriteria kebaikan peramalan data deret waktu

    MAD

    MAPE

    MSE

    AIC

    3

  • Data deret waktu stasioner (tanpa tren)

    Pemulusan rataan bergerak sederhana (RBS)

    Peramalan melalui RBS

    Data deret waktu tak-stasioner (ada tren)

    Pemulusan rataan bergerak ganda (RBG)

    Peramalan melalui RBG

    Contoh aplikasi pada data

    4

  • 5

  • “A time series is said to be strictly stationary if its properties are not affected by a change in the time origin.”

    Montgomerry (2015)

    6

  • 7

  • 8

  • 9

  • 10

  • 11

  • Plotting smoothed dataOverlay a smoothed version of the original data

    help reveal patterns in the original data

    The simplest approach: moving average

    12

  • 13

  • Bagaimana akurasi dari

    peramalannya?

    14

  • Single Moving Average

    Double Moving Average

    15

  • 16

  • Note that the smoothed data will have less variance*:

    *assuming independence between observations.

    17

  • 𝐹𝑡 = 𝑀𝑡−1

    Sedangkan untuk periode ke-n:

    𝐹𝑛,ℎ = 𝑀𝑛

    Artinya, peramalan untuk periode selanjutnya

    adalah konstan.18

  • Single moving average of order three:

    19

  • Monthly Time

    Periods

    Sales

    (units)MA(3) Forecast Error

    Jan 10

    Feb 9

    Mar 810+9+8

    3= 9.00

    Apr 79+8+7

    3= 8.00 9.00 -2.00

    May 3 6.00 8.00 -5.00

    Jun 2 4.00 6.00 -4.00

    Jul 1 2.00 4.00 -3.00

    Aug 0 1.00 2.00 -2.00

    Sep 1 0.67 1.00 0.00

    Oct 5 2.00 0.67 4.33

    Nov 12 6.00 2.00 10.00

    Dec 14 10.33 6.00 8.00

    Forecast 10.3320

  • 0

    2

    4

    6

    8

    10

    12

    14

    16

    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

    Sales (units) Forecast21

  • Monthly Time

    PeriodsSales (units) MA(5) Forecast

    Jan 10

    Feb 9

    Mar 8

    Apr 7

    May 3 7.4

    Jun 2 5.8 7.4

    Jul 1 4.2 5.8

    Aug 0 2.6 4.2

    Sep 1 1.4 2.6

    Oct 5 1.8 1.4

    Nov 12 3.8 1.8

    Dec 14 6.4 3.8

    Forecast 6.4 23

  • 0

    2

    4

    6

    8

    10

    12

    14

    16

    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

    Sales (units) Forecast24

  • 26

  • 27

  • an outlier will dominate the moving averages that contain that observation

    0

    50

    100

    150

    200

    250

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

    Actual Forecast 28

  • Moving Median

    Centered Moving Average

    29

  • Odd-span moving medians (also called running medians) are an alternative to moving averages that are effective data smoothers when the time series may be contaminated with unusual values or outliers.

    The moving median of span N is defined as

    where N = 2u + 1. The median is the middle observation in rank order (or order of value). The moving median of span 3 is a very popular and effective data smoother, where

    SUPPLEMENTARY TOPICS

    30

  • This is common for even numbers of observations.

    Monthly Time PeriodsSales

    (units)MA(3) Forecast

    Jan 10

    Feb 910+9+8

    3= 9.00

    Mar 89+8+7

    3= 8.00 9.00

    Apr 7 6.00 8.00

    May 3 4.00 6.00

    Jun 2 2.00 4.00

    Jul 1 1.00 2.00

    Aug 0 0.67 1.00

    Sep 1 2.00 0.67

    Oct 5 6.00 2.00

    Nov 12 10.33 6.00

    Dec 14 10.33

    Forecast 10.33

    SUPPLEMENTARY TOPICS

    31

  • 0

    2

    4

    6

    8

    10

    12

    14

    16

    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

    Sales (units) Forecase (centered) Forecast

    SUPPLEMENTARY TOPICS

    32

  • SUPPLEMENTARY TOPICS

    33

  • 34

  • A time series that exhibits a trend is a nonstationary time series.

    35

  • A double moving average may be used for additional smoothing of a single moving average.

    36

  • 1. Compute a single moving average (𝑆1) of order 𝑇

    2. A second moving average (𝑆2) series is calculated from the first moving average, is of order 𝑁

    37

  • dengan:

    𝑎𝑡 = 2 𝑆1,𝑡 − 𝑆2,𝑡

    𝑏𝑡 =2

    𝑁−1𝑆1,𝑡 − 𝑆2,𝑡

    38

  • Period Data Series

    1 34

    2 36

    3 38

    4 40

    5 42

    6 44

    7 46

    8 48

    9 50

    10 52

    Langkah 1:

    Lakukan pemulusan single moving

    average (misal, T=3):

    𝑆1,𝑡 =1

    3𝑦𝑡−2 + 𝑦𝑡−3 + 𝑦𝑡

    misal:

    𝑆1,3 =1

    3𝑦1 + 𝑦2 + 𝑦3

    𝑆1,3 =1

    334 + 36 + 38

    𝑆1,3 = 36

    39

  • Period Data Series 𝑺𝟏1 34

    2 36

    3 38 36

    4 40 38

    5 42 40

    6 44 42

    7 46 44

    8 48 46

    9 50 48

    10 52 50

    Langkah 2:

    Lakukan pemulusan single moving

    average (misal, N=3):

    𝑆2,𝑡 =1

    3𝑆𝑡−2 + 𝑆𝑡−3 + 𝑆𝑡

    misal:

    𝑆2,5 =1

    3𝑆3 + 𝑆4 + 𝑆5

    𝑆1,3 =1

    336 + 38 + 40

    𝑆1,3 = 38

    40

  • Period Data Series 𝑺𝟏 𝑺𝟐1 34

    2 36

    3 38 36

    4 40 38

    5 42 40 38

    6 44 42 40

    7 46 44 42

    8 48 46 44

    9 50 48 46

    10 52 50 48

    Menghitung Forecasts:

    𝑎𝑡 = 2 𝑆1,𝑡 − 𝑆2,𝑡

    𝑏𝑡 =2

    𝑁−1𝑆1,𝑡 − 𝑆2,𝑡

    misal utk t=5,

    𝑎5 = 2 𝑆1,5 − 𝑆2,5𝑎5 = 2 40 − 38𝑎5 = 42

    𝑏5 =2

    3−1𝑆1,5 − 𝑆2,5

    𝑏5 =2

    3−140 − 38

    𝑏5 = 2

    41

  • Period Data Series 𝑺𝟏,𝒕 𝑺𝟐,𝒕 𝒂𝒕 𝒃𝒕1 34

    2 36

    3 38 36

    4 40 38

    5 42 40 38 42 2

    6 44 42 40 44 2

    7 46 44 42 46 2

    8 48 46 44 48 2

    9 50 48 46 50 2

    10 52 50 48 52 2

    Menghitung Forecasts: 𝐹𝑡+ℎ = 𝑎𝑡 + 𝑏𝑡 ℎ

    𝐹6 = 𝐹5+1 = 𝑎5 + 𝑏5 1 = 42 + 2 1 = 4442

  • Period Data Series 𝑺𝟏,𝒕 𝑺𝟐,𝒕 𝒂𝒕 𝒃𝒕 𝑭𝒕1 34

    2 36

    3 38 36

    4 40 38

    5 42 40 38 42 2 44

    6 44 42 40 44 2 46

    7 46 44 42 46 2 48

    8 48 46 44 48 2 50

    9 50 48 46 50 2 52

    10 52 50 48 52 2 44

    11 54Menghitung Forecasts: 𝐹𝑡+ℎ = 𝑎𝑡 + 𝑏𝑡 ℎ

    𝐹6 = 𝐹5+1 = 𝑎5 + 𝑏5 1 = 42 + 2 1 = 4443

  • Two-sided Moving Average

    Weighted Moving Average

    44

  • 45

  • Perhatikan kembali ilustrasi-1 dan ilustrasi-2. HitungMAPE, MAD, dan MSE dari masing-masing kasustersebut.

    Menurut Anda, mana yang lebih baik di antarakeduanya?

    46

  • Berikut disajikan data penjualan mobil di Carmen’s Chevrolet. Lakukan pemulusan rataan bergerak tunggal dengan periode 3 minggu.

    a) Berapa nilai hasil peramalan pada minggu ke -7 menggunakan metode rataan bergerak dengan periode 3 minggu?

    b) Buatlah sketsa data aktual dan data hasil pemulusan

    Week 1 2 3 4 5 6 7

    Auto Sales 8 10 9 11 10 13 -

    47

  • Volume ekspor karet mentah Indonesia ke Negara Asia selama 11 tahun terakhir disajikan dalam table dibawah ini:

    Gambarkan plot data ekspor ini terhadap tahun.

    Apa penjelasan Anda mengenai perilaku ekspor tersebut?

    Berdasarkan pola data tersebut, menurut Anda, metode pemulusanmana yang lebih tepat utk digunakan pada data tsb?

    (Single atau Double Moving Average)

    Tahun 1998 1999 2000 2001 2002 2003

    Ekspor (ribuan ton) 97.43 96.22 98.29 98.61 97.19 99.58

    Tahun 2004 2005 2006 2007 2008

    Ekspor (ribuan ton) 101.03 100.04 102.6 101.3 101.81

    48

  • Hyndman, R.J. 2010. Moving Averages. Contribution to the InternationalEncyclopedia of Statistical Science, ed. Miodrag Lovric, Springer.pp.866-869. https://robjhyndman.com/papers/movingaverage.pdf[diakses pada 13 Februari 2018]

    Montgomery, D.C., Jennings, C.L., Kulahci, M. 2015 .Introduction to TimeSeries Analysis and Forecasting, 2nd ed. New Jersey: John Wiley &Sons.

    Yaffee, R.A., McGee, M. 2000. Introduction to Time Series Analysis andForecasting with Applications of SAS and SPSS. San Diego:Academic Press.

    49

    https://robjhyndman.com/papers/movingaverage.pdf