Moving Average dan Exponential Smoothing

Data

Library

library(readxl)
library(forecast)
library(TTR)
library(graphics)
library(smooth)
library(Mcomp)
library(ggplot2)

Import Data

Data yang digunakan adalah data hasil ekspor bulanan di Indonesia (dalam juta USD) dari Bulan Januari tahun 2011 sampai Desember tahun 2022 yang merupakan data deret waktu. Sumber data : https://www.bi.go.id.

ekspor <- read_excel("D:/Data Indikator - 2022.xlsx",sheet = "ekspor")
data.table::data.table(ekspor)
##            Time  Ekspor
##          <POSc>   <num>
##   1: 2011-01-01 14606.2
##   2: 2011-02-01 14415.3
##   3: 2011-03-01 16366.0
##   4: 2011-04-01 16554.2
##   5: 2011-05-01 18287.4
##  ---                   
## 140: 2022-08-01 27862.1
## 141: 2022-09-01 24777.2
## 142: 2022-10-01 24728.4
## 143: 2022-11-01 24094.0
## 144: 2022-12-01 23828.1
ekspor.ts<-ts(ekspor$Ekspor)
ekspor.ts.month<-ts(ekspor$Ekspor,start = c(2011,1),frequency = 12)

Plot Data

ekspor$Time <- as.Date(ekspor$Time, "%Y-%M-%D")
ggplot(ekspor, aes(x=Time, y = Ekspor)) + geom_line() 

Berdasarkan plot deret waktu diatas, terlihat bahwa data memiliki pola tidak stasioner.

Partisi Data

Data hasil ekspor di partisi menjadi dua bagian yaitu data training (Januari 2011-Desember 2020) dan data testing (Januari 2021-Desember 2022).

ekspor.training<-subset(ekspor.ts, start = 1, end =120 )
ekspor.training 
## Time Series:
## Start = 1 
## End = 120 
## Frequency = 1 
##   [1] 14606.20 14415.30 16366.00 16554.20 18287.40 18386.90 17418.50 18647.80
##   [9] 17543.40 16957.70 17235.50 17077.70 15570.20 15695.40 17251.50 16173.20
##  [17] 16829.50 15441.50 16090.60 14047.00 15898.10 15324.00 16316.90 15393.90
##  [25] 15375.50 15015.60 15024.60 14760.90 16133.40 14758.80 15087.90 13083.70
##  [33] 14706.80 15698.30 15938.60 16967.80 14472.30 14634.09 15192.60 14292.50
##  [41] 14823.60 15409.50 14124.10 14481.70 15275.80 15349.00 13616.20 14621.30
##  [49] 13355.80 12172.80 13634.30 13103.70 12690.20 13506.10 11465.80 12726.80
##  [57] 12588.40 12122.10 11111.20 11916.10 10480.60 11312.00 11810.02 11475.86
##  [65] 11514.28 12974.40  9530.80 12748.34 12568.50 12742.61 13503.60 13828.70
##  [73] 13397.68 12615.98 14718.48 13269.69 14333.86 11661.38 13611.06 15187.99
##  [81] 14580.22 15252.56 15334.74 14864.55 14576.30 14132.40 15510.60 14496.20
##  [89] 16198.30 12941.70 16284.70 15865.10 14956.30 15909.10 14851.70 14290.10
##  [97] 14028.10 12788.60 14447.80 13068.10 14751.80 11763.30 15238.40 14262.00
## [105] 14080.10 14881.50 13944.50 14428.80 13632.00 14060.90 14067.90 12163.10
## [113] 10454.30 12009.30 13702.70 13095.80 13960.50 14362.20 15259.30 16538.30
ekspor.test<-subset(ekspor.ts, start = 121, end = 144)
ekspor.test  
## Time Series:
## Start = 121 
## End = 144 
## Frequency = 1 
##  [1] 15293.7 15256.2 18354.4 18490.7 16932.9 18542.4 19385.8 21427.1 20605.6
## [10] 22029.7 22844.4 22359.5 19173.7 20472.9 26497.5 27322.3 21509.8 26150.1
## [19] 25563.2 27862.1 24777.2 24728.4 24094.0 23828.1

Plot Data Partisi

# data training
plot.ts(ekspor.training, main="Data Training Ekspor", xlab="Bulan", ylab="Ekspor")

# data testing
plot.ts(ekspor.test, main="Data Testing Ekspor", xlab="Bulan", ylab="Ekspor")

Berdasarkan plot deret waktu diatas, terlihat bahwa data training dan testing cenderung memiliki pola trend.

Simple Moving Average

Simple Moving Average N=3

Berikut merupakan hasil rata-rata bergerak (pemulusan) dengan simple moving average (N=3).

sma3<- SMA(ekspor.training, n=3)
head(sma3) 
## Time Series:
## Start = 1 
## End = 6 
## Frequency = 1 
## [1]       NA       NA 15129.17 15778.50 17069.20 17742.83

Berikutnya dihitung hasil ramalan dari simple moving average (N=3).

ramal3<-c(NA,sma3)
ramal3
##   [1]       NA       NA       NA 15129.17 15778.50 17069.20 17742.83 18030.93
##   [9] 18151.07 17869.90 17716.30 17245.53 17090.30 16627.80 16114.43 16172.37
##  [17] 16373.37 16751.40 16148.07 16120.53 15193.03 15345.23 15089.70 15846.33
##  [25] 15678.27 15695.43 15261.67 15138.57 14933.70 15306.30 15217.70 15326.70
##  [33] 14310.13 14292.80 14496.27 15447.90 16201.57 15792.90 15358.06 14766.33
##  [41] 14706.40 14769.57 14841.87 14785.73 14671.77 14627.20 15035.50 14747.00
##  [49] 14528.83 13864.43 13383.30 13054.30 12970.27 13142.73 13100.00 12554.03
##  [57] 12566.23 12260.33 12479.10 11940.57 11716.47 11169.30 11236.23 11200.87
##  [65] 11532.63 11600.06 11988.18 11339.83 11751.18 11615.88 12686.48 12938.24
##  [73] 13358.30 13576.66 13280.79 13577.38 13534.72 14107.34 13088.31 13202.10
##  [81] 13486.81 14459.76 15006.92 15055.84 15150.62 14925.19 14524.42 14739.77
##  [89] 14713.07 15401.70 14545.40 15141.57 15030.50 15702.03 15576.83 15239.03
##  [97] 15016.97 14389.97 13702.27 13754.83 13434.83 14089.23 13194.40 13917.83
## [105] 13754.57 14526.83 14407.87 14302.03 14418.27 14001.77 14040.57 13920.27
## [113] 13430.63 12228.43 11542.23 12055.43 12935.93 13586.33 13806.17 14527.33
## [121] 15386.60

Hasil perhitungan rata-rata bergerak dan ramalan digabungkan dengan data aktualnya:

ekspor3<-cbind(aktual=c(ekspor.training, rep(NA,2)),pemulusan=c(sma3,rep(NA,2)),ramalan=c(ramal3,rep(ramal3[length(ramal3)],1)))

#mengubah dataframe menjadi timeseries
ekspor3.ts<-ts(ekspor3, start=c(2011,1),frequency = 12)
head(ekspor3.ts)
##           aktual pemulusan  ramalan
## Jan 2011 14606.2        NA       NA
## Feb 2011 14415.3        NA       NA
## Mar 2011 16366.0  15129.17       NA
## Apr 2011 16554.2  15778.50 15129.17
## May 2011 18287.4  17069.20 15778.50
## Jun 2011 18386.9  17742.83 17069.20

Plot Data Aktual, Pemulusan (Nilai rata-rata bergerak), dan Peramalan

ts.plot(ekspor3.ts[,1], xlab="Bulan", ylab="ekspor Emas", lty=1, col="black")
lines(ekspor3.ts[,2],col="red",lty=1)
lines(ekspor3.ts[,3],col="blue",lty=2)
legend("topleft",c("Data aktual","Data pemulusan","Data peramalan"), lty=8,
       col=c("black","red","blue"), cex=0.8)

Ukuran Keakuratan Ramalan SMA (N=3)

error3=ekspor.training-ramal3[1:length(ekspor.training)]
error3
## Time Series:
## Start = 1 
## End = 120 
## Frequency = 1 
##   [1]            NA            NA            NA  1425.0333333  2508.9000000
##   [6]  1317.7000000  -324.3333333   616.8666667  -607.6666667  -912.2000000
##  [11]  -480.8000000  -167.8333333 -1520.1000000  -932.4000000  1137.0666667
##  [16]     0.8333333   456.1333333 -1309.9000000   -57.4666667 -2073.5333333
##  [21]   705.0666667   -21.2333333  1227.2000000  -452.4333333  -302.7666667
##  [26]  -679.8333333  -237.0666667  -377.6666667  1199.7000000  -547.5000000
##  [31]  -129.8000000 -2243.0000000   396.6666667  1405.5000000  1442.3333333
##  [36]  1519.9000000 -1729.2666667 -1158.8096100  -165.4634633  -473.8301300
##  [41]   117.2032033   639.9333333  -717.7666667  -304.0333333   604.0333333
##  [46]   721.8000000 -1419.3000000  -125.7000000 -1173.0333333 -1691.6333333
##  [51]   251.0000000    49.4000000  -280.0666667   363.3666667 -1634.2000000
##  [56]   172.7666667    22.1666667  -138.2333333 -1367.9000000   -24.4666667
##  [61] -1235.8666667   142.7000000   573.7908579   274.9855291   -18.3444959
##  [66]  1374.3439650 -2457.3813046  1408.5085962   817.3253107  1126.7298133
##  [71]   817.1164540   890.4619476    39.3732480  -960.6785475  1437.6920526
##  [76]  -307.6885790   799.1436504 -2445.9658951   522.7539919  1985.8915290
##  [81]  1093.4061528   792.8069901   327.8120557  -191.2913232  -574.3154054
##  [86]  -792.7942301   986.1843035  -243.5666667  1485.2333333 -2460.0000000
##  [91]  1739.3000000   723.5333333   -74.2000000   207.0666667  -725.1333333
##  [96]  -948.9333333  -988.8666667 -1601.3666667   745.5333333  -686.7333333
## [101]  1316.9666667 -2325.9333333  2044.0000000   344.1666667   325.5333333
## [106]   354.6666667  -463.3666667   126.7666667  -786.2666667    59.1333333
## [111]    27.3333333 -1757.1666667 -2976.3333333  -219.1333333  2160.4666667
## [116]  1040.3666667  1024.5666667   775.8666667  1453.1333333  2010.9666667
#MAE
MAE.SMA3=mean(abs(error3[4:length(ekspor.training)]))
MAE.SMA3
## [1] 877.7672
#RMSE
MSE3.sqrt=sqrt(mean(error3[4:length(ekspor.training)]^2))
MSE3.sqrt1=1.25*MAE.SMA3

#MAPE
MAPE3=mean(abs((error3[4:length(ekspor.training)]/ekspor.training[4:length(ekspor.training)])*100))
MAPE3
## [1] 6.309797
akurasi3<-data.frame("Ukuran keakuratan ramalan"=c("MAE", "RMSE", "MAPE"),
                     "Simple Moving Average N=3"=c(MAE.SMA3 , MSE3.sqrt, MAPE3))

akurasi3
##   Ukuran.keakuratan.ramalan Simple.Moving.Average.N.3
## 1                       MAE                877.767174
## 2                      RMSE               1115.889103
## 3                      MAPE                  6.309797

Simple Moving Average N=4

Berikut merupakan hasil rata-rata bergerak (pemulusan) dengan simple moving average (N=3).

sma4<- SMA(ekspor.training, n=4)
head(sma4)
## Time Series:
## Start = 1 
## End = 6 
## Frequency = 1 
## [1]       NA       NA       NA 15485.42 16405.73 17398.63

Berikutnya dihitung hasil ramalan dari simple moving average (N=4).

ramal4<-c(NA,sma4)
head(ramal4)
## [1]       NA       NA       NA       NA 15485.42 16405.73

Hasil perhitungan rata-rata bergerak dan ramalan digabungkan dengan data aktualnya:

ekspor4<-cbind(aktual=c(ekspor.training, rep(NA,2)),pemulusan=c(sma4,rep(NA,2)),ramalan=c(ramal4,rep(ramal4[length(ramal4)],1)))
ekspor4.ts<-ts(ekspor4, start=c(2011,1),frequency = 12)
head(ekspor4.ts)
##           aktual pemulusan  ramalan
## Jan 2011 14606.2        NA       NA
## Feb 2011 14415.3        NA       NA
## Mar 2011 16366.0        NA       NA
## Apr 2011 16554.2  15485.42       NA
## May 2011 18287.4  16405.73 15485.42
## Jun 2011 18386.9  17398.63 16405.73

Plot Data Aktual, Pemulusan, dan Peramalan

ts.plot(ekspor4.ts[,1], xlab="Bulan", ylab="ekspor Emas", lty=1, col="black")
lines(ekspor4.ts[,2],col="red",lty=1)
lines(ekspor4.ts[,3],col="blue",lty=2)
legend("topleft",c("Data aktual","Data pemulusan","Data peramalan"), lty=8,
       col=c("black","red","blue"), cex=0.8)

Ukuran Keakuratan Ramalan

error4=ekspor.training-ramal4[1:length(ekspor.training)]
error4
## Time Series:
## Start = 1 
## End = 120 
## Frequency = 1 
##   [1]          NA          NA          NA          NA  2801.97500  1981.17500
##   [7]    19.87500   986.05000  -641.75000 -1041.45000  -406.35000  -518.40000
##  [13] -1633.37500 -1014.87500   856.80000  -225.50000   656.92500 -1045.90000
##  [19]  -333.32500 -2086.70000   295.95000   -45.30000   976.97500    -2.60000
##  [25]  -357.72500  -586.97500  -500.87500  -441.50000  1089.25000  -474.82500
##  [31]   -81.52500 -2101.55000   -59.15000  1289.00000  1294.42500  2110.95000
##  [37] -1355.57500 -1135.15961  -310.59760 -1024.19760   175.72740   673.80240
##  [43]  -805.45000  -180.72500   566.07500   526.22500 -1191.45000   -59.37500
##  [49] -1359.77500 -2062.77500   192.77500  -342.35000  -376.45000   605.85000
##  [55] -1767.77500    35.35000    -8.82500  -449.67500 -1114.57500  -221.02500
##  [61] -1453.85000   -95.50000   605.04919    96.17921   244.66254  1446.35797
##  [67] -2412.84203  1374.50050   876.54910   787.09986  1606.03734   937.93734
##  [73]   236.82305  -752.16634  1381.98846  -370.51903   833.40347 -2073.12540
##  [79]   115.21170  1968.99399   881.64376  1492.40203   676.77732  -224.32947
##  [85]  -431.71558  -874.63655   783.60433  -274.76177  1519.42500 -2142.67500
##  [91]  1498.00000   884.87500  -366.15000   897.15000  -902.10000 -1105.45000
##  [97]  -973.70000 -1981.15000   458.17500  -820.55000  1168.65000 -2000.77500
## [103]  1730.65000   556.60000    76.22500  1045.55000  -671.00000   136.77500
## [109]  -701.72500  -160.80000    51.35000 -1884.30000 -3026.67500  -677.25000
## [115]  1529.05000  1013.45000  1644.97500  1170.12500  1479.00000  2368.85000
#MAE
MAE.SMA4=mean(abs(error4[5:length(ekspor.training)]))
MAE.SMA4
## [1] 917.6931
#RMSE
MSE4.sqrt=sqrt(mean(error4[5:length(ekspor.training)]^2))
MSE4.sqrt1=1.25*MAE.SMA4

#MAPE
MAPE4=mean(abs((error4[5:length(ekspor.training)]/ekspor.training[5:length(ekspor.training)])*100))
MAPE4
## [1] 6.584614
akurasi4<-data.frame("Ukuran keakuratan ramalan"=c("MAE", "RMSE", "MAPE"),
                     "Simple Moving Average N=4"=c( MAE.SMA4, MSE4.sqrt,MAPE4))

akurasi4
##   Ukuran.keakuratan.ramalan Simple.Moving.Average.N.4
## 1                       MAE                917.693120
## 2                      RMSE               1142.196663
## 3                      MAPE                  6.584614

Simple Moving Average N=5

Berikut merupakan hasil rata-rata bergerak (pemulusan) dengan simple moving average (N=5).

sma5<- SMA(ekspor.training, n=5)
head(sma5)
## Time Series:
## Start = 1 
## End = 6 
## Frequency = 1 
## [1]       NA       NA       NA       NA 16045.82 16801.96

Berikutnya dihitung hasil ramalan dari simple moving average (N=5).

ramal5<-c(NA,sma5)
head(ramal5)
## [1]       NA       NA       NA       NA       NA 16045.82

Hasil perhitungan rata-rata bergerak dan ramalan digabungkan dengan data aktualnya:

ekspor5<-cbind(aktual=c(ekspor.training, rep(NA,2)),pemulusan=c(sma5,rep(NA,2)),ramalan=c(ramal5,rep(ramal5[length(ramal5)],1)))
ekspor5.ts<-ts(ekspor5, start=c(2011,1),frequency = 12)
head(ekspor5.ts)
##           aktual pemulusan  ramalan
## Jan 2011 14606.2        NA       NA
## Feb 2011 14415.3        NA       NA
## Mar 2011 16366.0        NA       NA
## Apr 2011 16554.2        NA       NA
## May 2011 18287.4  16045.82       NA
## Jun 2011 18386.9  16801.96 16045.82

Plot Data Aktual, Pemulusan, dan Peramalan

ts.plot(ekspor5.ts[,1], xlab="Bulan", ylab="ekspor Emas", lty=1, col="black")
lines(ekspor5.ts[,2],col="red",lty=1)
lines(ekspor5.ts[,3],col="blue",lty=2)
legend("topleft",c("Data aktual","Data pemulusan","Data peramalan"), lty=8,
       col=c("black","red","blue"), cex=0.8)

Ukuran Keakuratan Ramalan

error5=ekspor.training-ramal5[1:length(ekspor.training)]
error5
## Time Series:
## Start = 1 
## End = 120 
## Frequency = 1 
##   [1]          NA          NA          NA          NA          NA  2341.08000
##   [7]   616.54000  1245.20000  -315.56000 -1099.10000  -555.36000  -482.88000
##  [13] -1922.22000 -1181.50000   744.20000  -392.86000   475.90000  -862.46000
##  [19]  -187.62000 -2310.26000   181.74000  -337.34000   956.66000  -141.42000
##  [25]   -20.48000  -646.08000  -460.58000  -664.40000  1019.30000  -503.20000
##  [31]   -50.76000 -2069.42000   -58.14000   944.18000  1271.50000  2064.74000
##  [37]  -806.74000  -922.66961  -349.61808 -1148.57808  -288.25808   726.48192
##  [43]  -746.35808  -286.76000   649.52000   526.06000 -1311.82000    51.94000
##  [49] -1313.00000 -2270.82000  -188.72000  -376.38000  -687.38000   514.74000
##  [55] -1555.62000  -153.22000  -110.12000  -473.36000 -1370.64000   -86.76000
##  [61] -1612.32000  -331.68000   421.62419   149.87542   115.36676  1655.84638
##  [67] -2286.51362  1287.26286   919.76806   875.34516  1390.66987  1609.92987
##  [73]   319.32646  -592.23783  1500.76430  -343.19730   767.75468 -2005.76037
##  [79]   291.18579  1669.09786   967.42031  1377.66242  1276.09370    71.23334
##  [85]  -467.71066  -789.27247   678.49076  -387.51654  1482.29058 -2041.06000
##  [91]  1628.86000   778.80000  -200.90000   659.88000  -339.68000 -1283.28000
##  [97] -1146.36000 -2018.46000    74.28000 -1013.16000  1027.26000 -2053.58000
## [103]  1874.48000   408.12000   263.38000   862.38000  -100.56000   -52.50000
## [109]  -687.38000  -132.48000  -121.64000 -1863.72000 -3216.24000  -866.34000
## [115]  1151.60000   616.34000  1675.46000  1717.68000  1833.20000  2462.20000
#MAE
MAE.SMA5=mean(abs(error5[6:length(ekspor.training)]))
MAE.SMA5
## [1] 911.7628
#RMSE
MSE5.sqrt=sqrt(mean(error5[6:length(ekspor.training)]^2))
MSE5.sqrt1=1.25*MAE.SMA5

#MAPE
MAPE5=mean(abs((error5[6:length(ekspor.training)]/ekspor.training[6:length(ekspor.training)])*100))
MAPE5
## [1] 6.584178
akurasi5<-data.frame("Ukuran keakuratan ramalan"=c("MAE",  "RMSE", "MAPE"),
                     "Simple Moving Average N=5"=c( MAE.SMA5, MSE5.sqrt, MAPE5))

akurasi5
##   Ukuran.keakuratan.ramalan Simple.Moving.Average.N.5
## 1                       MAE                911.762795
## 2                      RMSE               1141.387777
## 3                      MAPE                  6.584178

Perbandingan SMA (N=3,4,5)

gabungan_akurasi<-cbind(akurasi3,akurasi4$Simple.Moving.Average.N.4,akurasi5$Simple.Moving.Average.N.5)
gabungan_akurasi
##   Ukuran.keakuratan.ramalan Simple.Moving.Average.N.3
## 1                       MAE                877.767174
## 2                      RMSE               1115.889103
## 3                      MAPE                  6.309797
##   akurasi4$Simple.Moving.Average.N.4 akurasi5$Simple.Moving.Average.N.5
## 1                         917.693120                         911.762795
## 2                        1142.196663                        1141.387777
## 3                           6.584614                           6.584178

Berdasarkan perbandingan menggunakan tiga ukuran keakuratan ramalan di atas dapat diketahui bahwa simple moving average dengan ordo 3 memiliki keakuratan terbaik dikarenakan memiliki nilai MAE, RMSE, dan MAPE terendah.

Validasi Model SMA 3 (Data Testing)

tail(ramal3)
## [1] 12055.43 12935.93 13586.33 13806.17 14527.33 15386.60

Berdasarkan hasil ramalan di atas dapat diketahui bahwa nilai ekspor untuk 24 bulan ke depan adalah 15386.60. Hal ini dikarenakan Model SMA hanya mampu digunakan untuk memodelkan data stasioner dan lemah jika digunakan untuk meramalkan data dengan pola lain seperti trend dan seasonal.

ramal3 <- read_excel("D:/ramal3.xlsx")
ramal3<-ts(ramal3)
ramal3
## Time Series:
## Start = 1 
## End = 24 
## Frequency = 1 
##       hasilramal
##  [1,]    15386.6
##  [2,]    15386.6
##  [3,]    15386.6
##  [4,]    15386.6
##  [5,]    15386.6
##  [6,]    15386.6
##  [7,]    15386.6
##  [8,]    15386.6
##  [9,]    15386.6
## [10,]    15386.6
## [11,]    15386.6
## [12,]    15386.6
## [13,]    15386.6
## [14,]    15386.6
## [15,]    15386.6
## [16,]    15386.6
## [17,]    15386.6
## [18,]    15386.6
## [19,]    15386.6
## [20,]    15386.6
## [21,]    15386.6
## [22,]    15386.6
## [23,]    15386.6
## [24,]    15386.6

Ukuran Keakuratan Ramalan

error33=ekspor.test-ramal3[1:length(ekspor.test)]
error33
## Time Series:
## Start = 121 
## End = 144 
## Frequency = 1 
##  [1]   -92.9  -130.4  2967.8  3104.1  1546.3  3155.8  3999.2  6040.5  5219.0
## [10]  6643.1  7457.8  6972.9  3787.1  5086.3 11110.9 11935.7  6123.2 10763.5
## [19] 10176.6 12475.5  9390.6  9341.8  8707.4  8441.5
#MAD
MAD.SMA33=mean(abs(error33[3:length(ekspor.test)]))
MAD.SMA33
## [1] 7020.3
#RMSE
MSE33.sqrt=sqrt(mean(error33[3:length(ekspor.test)]^2))
MSE33.sqrt1=1.25*MAD.SMA33


#MAPE
MAPE33=mean(abs((error33[3:length(ekspor.test)]/ekspor.test[3:length(ekspor.test)])*100))
MAPE33
## [1] 29.95056
akurasi33<-data.frame("Ukuran keakuratan ramalan"=c("MAD", "RMSE", "MAPE"),
                    "Simple Moving Average N=3"=c(MAD.SMA33 ,MSE33.sqrt, MAPE33))

akurasi33
##   Ukuran.keakuratan.ramalan Simple.Moving.Average.N.3
## 1                       MAD                7020.30000
## 2                      RMSE                7687.31903
## 3                      MAPE                  29.95056

Single Exponential Smoothing

Single Exponential Smoothing Alpha 0.25

holtw1 <- HoltWinters(ekspor.training, alpha = 0.25, beta=FALSE, gamma=FALSE) 
holtw1
## Holt-Winters exponential smoothing without trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, alpha = 0.25, beta = FALSE,     gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.25
##  beta : FALSE
##  gamma: FALSE
## 
## Coefficients:
##       [,1]
## a 14581.54
head(holtw1$fitted)
## Time Series:
## Start = 2 
## End = 7 
## Frequency = 1 
##       xhat    level
## 2 14606.20 14606.20
## 3 14558.48 14558.48
## 4 15010.36 15010.36
## 5 15396.32 15396.32
## 6 16119.09 16119.09
## 7 16686.04 16686.04
# forecast
holtw1_f<-forecast(holtw1, h=24)
holtw1_f
##     Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 121       14581.54 13086.05 16077.03 12294.39 16868.69
## 122       14581.54 13040.02 16123.05 12224.00 16939.08
## 123       14581.54 12995.33 16167.74 12155.65 17007.43
## 124       14581.54 12951.87 16211.21 12089.17 17073.91
## 125       14581.54 12909.53 16253.55 12024.42 17138.65
## 126       14581.54 12868.24 16294.84 11961.28 17201.80
## 127       14581.54 12827.92 16335.16 11899.61 17263.46
## 128       14581.54 12788.51 16374.57 11839.34 17323.74
## 129       14581.54 12749.95 16413.13 11780.36 17382.72
## 130       14581.54 12712.18 16450.90 11722.60 17440.48
## 131       14581.54 12675.16 16487.92 11665.98 17497.10
## 132       14581.54 12638.84 16524.24 11610.44 17552.64
## 133       14581.54 12603.19 16559.89 11555.92 17607.16
## 134       14581.54 12568.18 16594.90 11502.36 17660.71
## 135       14581.54 12533.76 16629.32 11449.73 17713.35
## 136       14581.54 12499.91 16663.17 11397.96 17765.12
## 137       14581.54 12466.60 16696.48 11347.02 17816.06
## 138       14581.54 12433.81 16729.27 11296.87 17866.21
## 139       14581.54 12401.51 16761.57 11247.47 17915.61
## 140       14581.54 12369.68 16793.40 11198.79 17964.28
## 141       14581.54 12338.31 16824.77 11150.81 18012.27
## 142       14581.54 12307.36 16855.72 11103.49 18059.59
## 143       14581.54 12276.84 16886.24 11056.80 18106.28
## 144       14581.54 12246.71 16916.37 11010.72 18152.36
autoplot(holtw1_f, fcol = "red") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
accuracy(holtw1_f, ekspor.test)
##                        ME     RMSE       MAE        MPE      MAPE      MASE
## Training set   -0.8289378 1162.023  911.9938 -0.6240384  6.541993 0.8793507
## Test set     7231.0317338 8072.552 7231.0317 31.1926724 31.192672 6.9722107
##                   ACF1 Theil's U
## Training set 0.1869430        NA
## Test set     0.6935623  3.107437

Single Exponential Smoothing Alpha 0.50

holtw2 <- HoltWinters(ekspor.training, alpha = 0.50, beta=FALSE, gamma=FALSE) 
holtw2
## Holt-Winters exponential smoothing without trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, alpha = 0.5, beta = FALSE, gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.5
##  beta : FALSE
##  gamma: FALSE
## 
## Coefficients:
##       [,1]
## a 15560.98
head(holtw2$fitted)
## Time Series:
## Start = 2 
## End = 7 
## Frequency = 1 
##       xhat    level
## 2 14606.20 14606.20
## 3 14510.75 14510.75
## 4 15438.38 15438.38
## 5 15996.29 15996.29
## 6 17141.84 17141.84
## 7 17764.37 17764.37
# forecast
holtw2_f<-forecast(holtw2, h=24)
holtw2_f
##     Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
## 121       15560.98 14128.14 16993.81 13369.641 17752.31
## 122       15560.98 13959.02 17162.94 13110.989 18010.96
## 123       15560.98 13806.12 17315.83 12877.150 18244.80
## 124       15560.98 13665.51 17456.44 12662.113 18459.84
## 125       15560.98 13534.64 17587.31 12461.961 18659.99
## 126       15560.98 13411.72 17710.23 12273.974 18847.98
## 127       15560.98 13295.46 17826.49 12096.172 19025.78
## 128       15560.98 13184.88 17937.07 11927.059 19194.89
## 129       15560.98 13079.23 18042.72 11765.473 19356.48
## 130       15560.98 12977.89 18144.06 11610.491 19511.46
## 131       15560.98 12880.38 18241.57 11461.364 19660.59
## 132       15560.98 12786.30 18335.65 11317.475 19804.48
## 133       15560.98 12695.30 18426.65 11178.307 19943.64
## 134       15560.98 12607.11 18514.84 11043.424 20078.53
## 135       15560.98 12521.47 18600.48 10912.453 20209.50
## 136       15560.98 12438.18 18683.77 10785.073 20336.88
## 137       15560.98 12357.06 18764.89 10661.003 20460.95
## 138       15560.98 12277.93 18844.02 10539.998 20581.95
## 139       15560.98 12200.68 18921.27 10421.841 20700.11
## 140       15560.98 12125.15 18996.80 10306.340 20815.61
## 141       15560.98 12051.26 19070.69 10193.325 20928.63
## 142       15560.98 11978.88 19143.07 10082.640 21039.31
## 143       15560.98 11907.94 19214.01  9974.147 21147.80
## 144       15560.98 11838.36 19283.59  9867.722 21254.23
autoplot(holtw2_f, fcol = "red") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
accuracy(holtw2_f, ekspor.test)
##                      ME     RMSE       MAE        MPE      MAPE      MASE
## Training set   16.04664 1113.456  890.4279 -0.3915778  6.388531 0.8585567
## Test set     6251.59556 7208.378 6299.2664 26.5709116 26.883023 6.0737961
##                    ACF1 Theil's U
## Training set -0.1269137        NA
## Test set      0.6935623  2.752158

Single Exponential Smoothing Alpha 0.75

holtw3 <- HoltWinters(ekspor.training, alpha = 0.75, beta=FALSE, gamma=FALSE) 
holtw3
## Holt-Winters exponential smoothing without trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, alpha = 0.75, beta = FALSE,     gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.75
##  beta : FALSE
##  gamma: FALSE
## 
## Coefficients:
##       [,1]
## a 16152.94
head(holtw3$fitted)
## Time Series:
## Start = 2 
## End = 7 
## Frequency = 1 
##       xhat    level
## 2 14606.20 14606.20
## 3 14463.02 14463.02
## 4 15890.26 15890.26
## 5 16388.21 16388.21
## 6 17812.60 17812.60
## 7 18243.33 18243.33
# forecast
holtw3_f<-forecast(holtw3, h=24)
holtw3_f
##     Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
## 121       16152.94 14646.21 17659.68 13848.586 18457.30
## 122       16152.94 14269.52 18036.37 13272.496 19033.39
## 123       16152.94 13956.51 18349.38 12793.793 19512.10
## 124       16152.94 13682.86 18623.03 12375.272 19930.62
## 125       16152.94 13436.63 18869.26 11998.703 20307.19
## 126       16152.94 13210.94 19094.95 11653.540 20652.35
## 127       16152.94 13001.37 19304.52 11333.032 20972.86
## 128       16152.94 12804.90 19500.99 11032.547 21273.34
## 129       16152.94 12619.33 19686.56 10748.744 21557.14
## 130       16152.94 12443.03 19862.86 10479.119 21826.77
## 131       16152.94 12274.74 20031.15 10221.738 22084.15
## 132       16152.94 12113.45 20192.44  9975.071 22330.82
## 133       16152.94 11958.36 20347.53  9737.881 22568.01
## 134       16152.94 11808.80 20497.09  9509.154 22796.73
## 135       16152.94 11664.23 20641.66  9288.044 23017.85
## 136       16152.94 11524.16 20781.72  9073.836 23232.05
## 137       16152.94 11388.22 20917.67  8865.922 23439.97
## 138       16152.94 11256.04 21049.85  8663.779 23642.11
## 139       16152.94 11127.34 21178.55  8466.949 23838.94
## 140       16152.94 11001.86 21304.03  8275.037 24030.85
## 141       16152.94 10879.36 21426.53  8087.689 24218.20
## 142       16152.94 10759.64 21546.25  7904.595 24401.29
## 143       16152.94 10642.52 21663.37  7725.479 24580.41
## 144       16152.94 10527.84 21778.05  7550.091 24755.80
autoplot(holtw3_f, fcol = "red") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
accuracy(holtw3_f, ekspor.test)
##                      ME     RMSE       MAE        MPE      MAPE      MASE
## Training set   17.33047 1170.893  938.1305 -0.3533665  6.757891 0.9045519
## Test set     5659.62627 6701.465 5805.9587 23.7775285 24.735545 5.5981454
##                    ACF1 Theil's U
## Training set -0.3554709        NA
## Test set      0.6935623  2.545397

Single Exponential Smoothing Alpha Optimum

holtw4 <- HoltWinters(ekspor.training, beta=FALSE, gamma=FALSE)
holtw4
## Holt-Winters exponential smoothing without trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, beta = FALSE, gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.4584562
##  beta : FALSE
##  gamma: FALSE
## 
## Coefficients:
##       [,1]
## a 15428.91
head(holtw4$fitted)
## Time Series:
## Start = 2 
## End = 7 
## Frequency = 1 
##       xhat    level
## 2 14606.20 14606.20
## 3 14518.68 14518.68
## 4 15365.60 15365.60
## 5 15910.52 15910.52
## 6 17000.21 17000.21
## 7 17635.95 17635.95
# forecast
holtw4_f<-forecast(holtw4, h=24)
holtw4_f
##     Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 121       15428.91 13997.85 16859.97 13240.29 17617.52
## 122       15428.91 13854.63 17003.19 13021.25 17836.56
## 123       15428.91 13723.39 17134.43 12820.54 18037.28
## 124       15428.91 13601.55 17256.27 12634.21 18223.61
## 125       15428.91 13487.34 17370.47 12459.54 18398.28
## 126       15428.91 13379.49 17478.33 12294.59 18563.22
## 127       15428.91 13277.04 17580.78 12137.91 18719.91
## 128       15428.91 13179.24 17678.57 11988.34 18869.47
## 129       15428.91 13085.53 17772.29 11845.02 19012.80
## 130       15428.91 12995.42 17862.40 11707.21 19150.61
## 131       15428.91 12908.53 17949.29 11574.32 19283.49
## 132       15428.91 12824.54 18033.28 11445.87 19411.95
## 133       15428.91 12743.17 18114.64 11321.43 19536.39
## 134       15428.91 12664.20 18193.62 11200.65 19657.16
## 135       15428.91 12587.42 18270.40 11083.23 19774.59
## 136       15428.91 12512.66 18345.15 10968.90 19888.92
## 137       15428.91 12439.77 18418.04 10857.42 20000.39
## 138       15428.91 12368.62 18489.20 10748.60 20109.21
## 139       15428.91 12299.08 18558.73 10642.26 20215.56
## 140       15428.91 12231.06 18626.76 10538.22 20319.60
## 141       15428.91 12164.45 18693.36 10436.35 20421.46
## 142       15428.91 12099.18 18758.64 10336.52 20521.29
## 143       15428.91 12035.16 18822.66 10238.61 20619.20
## 144       15428.91 11972.32 18885.49 10142.52 20715.30
autoplot(holtw4_f, fcol = "red") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
akurasi.holtw4<-accuracy(holtw4_f, ekspor.test)
akurasi.holtw4
##                      ME     RMSE       MAE        MPE      MAPE      MASE
## Training set   15.07999 1112.061  885.1377 -0.4082788  6.346038 0.8534559
## Test set     6383.66237 7323.211 6409.3221 27.1941081 27.362119 6.1799126
##                     ACF1 Theil's U
## Training set -0.08211838        NA
## Test set      0.69356234  2.799194

Kesimpulan

Nilai Alpha optimum pada Single exponential smoothing adalah 0.4584562, nilai ini menghasilkan ukuran keakuratan ramalan terbaik dibandingkan dengan Single exponential smoothing alpha 0.25, 0.50, dan 0.75.

Double Exponential Smoothing

Double Exponential Smoothing dengan Alpha dan Beta 0.25

hw1<-HoltWinters(ekspor.training, alpha = 0.25, beta = 0.25, gamma = FALSE) 
hw1
## Holt-Winters exponential smoothing with trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, alpha = 0.25, beta = 0.25, gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.25
##  beta : 0.25
##  gamma: FALSE
## 
## Coefficients:
##         [,1]
## a 14526.7647
## b   351.7553
head(hw1$fitted)
## Time Series:
## Start = 3 
## End = 8 
## Frequency = 1 
##       xhat    level      trend
## 3 14224.40 14415.30 -190.90000
## 4 14702.75 14759.80  -57.05000
## 5 15224.28 15165.61   58.66562
## 6 16240.17 15990.06  250.11074
## 7 17161.13 16776.85  384.28141
## 8 17625.84 17225.48  400.36682
# forecast
hw1_f<-forecast(hw1, h=24)
hw1_f
##     Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 121       14878.52 13292.31 16464.73 12452.63 17304.41
## 122       15230.28 13568.42 16892.13 12688.69 17771.86
## 123       15582.03 13816.93 17347.13 12882.54 18281.52
## 124       15933.79 14037.17 17830.41 13033.16 18834.42
## 125       16285.54 14229.77 18341.31 13141.52 19429.57
## 126       16637.30 14396.25 18878.34 13209.92 20064.68
## 127       16989.05 14538.52 19439.58 13241.29 20736.82
## 128       17340.81 14658.58 20023.03 13238.70 21442.92
## 129       17692.56 14758.35 20626.78 13205.07 22180.06
## 130       18044.32 14839.54 21249.09 13143.03 22945.60
## 131       18396.07 14903.66 21888.49 13054.89 23737.26
## 132       18747.83 14952.00 22543.66 12942.61 24553.05
## 133       19099.58 14985.66 23213.51 12807.88 25391.29
## 134       19451.34 15005.58 23897.10 12652.14 26250.54
## 135       19803.09 15012.57 24593.62 12476.62 27129.57
## 136       20154.85 15007.31 25302.39 12282.37 28027.33
## 137       20506.61 14990.40 26022.81 12070.30 28942.91
## 138       20858.36 14962.36 26754.36 11841.21 29875.51
## 139       21210.12 14923.65 27496.58 11595.79 30824.44
## 140       21561.87 14874.65 28249.09 11334.66 31789.09
## 141       21913.63 14815.74 29011.51 11058.35 32768.91
## 142       22265.38 14747.23 29783.54 10767.35 33763.41
## 143       22617.14 14669.39 30564.88 10462.11 34772.16
## 144       22968.89 14582.51 31355.28 10143.02 35794.76
autoplot(hw1_f, fcol = "orange") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
accuracy(hw1_f, ekspor.test)
##                      ME     RMSE       MAE         MPE      MAPE      MASE
## Training set   73.58038 1234.662  993.6101  0.09321529  7.058205 0.9580457
## Test set     2888.86465 3536.488 2888.8647 12.41122711 12.411227 2.7854632
##                   ACF1 Theil's U
## Training set 0.2242680        NA
## Test set     0.2492717  1.412556

Double Exponential Smoothing dengan Alpha dan Beta 0.50

hw2<-HoltWinters(ekspor.training, alpha = 0.50, beta = 0.50, gamma = FALSE) 
hw2
## Holt-Winters exponential smoothing with trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, alpha = 0.5, beta = 0.5, gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.5
##  beta : 0.5
##  gamma: FALSE
## 
## Coefficients:
##         [,1]
## a 16172.2439
## b   927.7673
head(hw2$fitted)
## Time Series:
## Start = 3 
## End = 8 
## Frequency = 1 
##       xhat    level     trend
## 3 14224.40 14415.30 -190.9000
## 4 15639.70 15295.20  344.5000
## 5 16670.07 16096.95  573.1250
## 6 18456.19 17478.74  977.4562
## 7 19381.68 18421.55  960.1328
## 8 18869.43 18400.09  469.3379
# forecast
hw2_f<-forecast(hw2, h=24)
hw2_f
##     Point Forecast     Lo 80    Hi 80      Lo 95    Hi 95
## 121       17100.01 15508.926 18691.10 14666.6565 19533.37
## 122       18027.78 16038.922 20016.64 14986.0852 21069.47
## 123       18955.55 16408.567 21502.52 15060.2778 22850.81
## 124       19883.31 16651.804 23114.82 14941.1465 24825.48
## 125       20811.08 16793.788 24828.37 14667.1611 26955.00
## 126       21738.85 16850.953 26626.74 14263.4571 29214.24
## 127       22666.62 16834.143 28499.09 13746.6193 31586.61
## 128       23594.38 16750.867 30437.90 13128.1282 34060.64
## 129       24522.15 16606.601 32437.70 12416.3631 36627.94
## 130       25449.92 16405.540 34494.30 11617.7351 39282.10
## 131       26377.68 16151.017 36604.35 10737.3457 42018.02
## 132       27305.45 15845.773 38765.13  9779.3846 44831.52
## 133       28233.22 15492.114 40974.32  8747.3802 47719.06
## 134       29160.99 15092.024 43229.95  7644.3649 50677.61
## 135       30088.75 14647.234 45530.27  6472.9869 53704.52
## 136       31016.52 14159.277 47873.77  5235.5903 56797.45
## 137       31944.29 13629.523 50259.05  3934.2723 59954.31
## 138       32872.06 13059.213 52684.90  2570.9268 63173.19
## 139       33799.82 12449.471 55150.18  1147.2765 66452.37
## 140       34727.59 11801.329 57653.85  -335.1004 69790.28
## 141       35655.36 11115.739 60194.98 -1874.7508 73185.47
## 142       36583.13 10393.579 62772.67 -3470.3295 76636.58
## 143       37510.89  9635.667 65386.12 -5120.5862 80142.37
## 144       38438.66  8842.766 68034.55 -6824.3543 83701.67
autoplot(hw2_f, fcol = "orange") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
accuracy(hw2_f, ekspor.test)
##                       ME     RMSE       MAE         MPE      MAPE      MASE
## Training set    37.92093 1236.840  985.4471  -0.1144615  7.078871 0.9501749
## Test set     -5956.76495 7139.795 5956.7649 -26.5320033 26.532003 5.7435538
##                    ACF1 Theil's U
## Training set -0.1513228        NA
## Test set      0.6787059  2.672508

Double Exponential Smoothing dengan Alpha dan Beta 0.75

hw3<-HoltWinters(ekspor.training, alpha = 0.75, beta = 0.75, gamma = FALSE)
hw3
## Holt-Winters exponential smoothing with trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, alpha = 0.75, beta = 0.75, gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.75
##  beta : 0.75
##  gamma: FALSE
## 
## Coefficients:
##        [,1]
## a 16364.374
## b  1073.028
head(hw3$fitted)
## Time Series:
## Start = 3 
## End = 8 
## Frequency = 1 
##       xhat    level     trend
## 3 14224.40 14415.30 -190.9000
## 4 16844.35 15830.60 1013.7500
## 5 17477.28 16626.74  850.5406
## 6 19391.10 18084.87 1306.2342
## 7 19379.32 18637.95  741.3696
## 8 17547.11 17908.71 -361.5920
# forecast
hw3_f<-forecast(hw3, h=24)
hw3_f
##     Point Forecast       Lo 80     Hi 80       Lo 95     Hi 95
## 121       17437.40  15516.3368  19358.47  14499.3862  20375.42
## 122       18510.43  15340.5812  21680.28  13662.5645  23358.30
## 123       19583.46  14785.2990  24381.62  12245.3071  26921.61
## 124       20656.49  13952.0810  27360.89  10402.9835  30909.99
## 125       21729.51  12888.5026  30570.52   8208.3541  35250.67
## 126       22802.54  11622.1563  33982.93   5703.6179  39901.47
## 127       23875.57  10171.6630  37579.48   2917.2533  44833.89
## 128       24948.60   8550.8239  41346.37   -129.6329  50026.83
## 129       26021.63   6770.4909  45272.76  -3420.4439  55463.69
## 130       27094.65   4839.5405  49349.77  -6941.6043  61130.91
## 131       28167.68   2765.4378  53569.92 -10681.6972  67017.06
## 132       29240.71    554.5916  57926.83 -14630.9214  73112.34
## 133       30313.74  -1787.4084  62414.88 -18780.7280  79408.20
## 134       31386.76  -4255.6251  67029.15 -23123.5663  85897.09
## 135       32459.79  -6845.6522  71765.24 -27652.6976  92572.28
## 136       33532.82  -9553.5235  76619.16 -32362.0560  99427.70
## 137       34605.85 -12375.6424  81587.34 -37246.1410 106457.84
## 138       35678.88 -15308.7272  86666.48 -42299.9336 113657.68
## 139       36751.90 -18349.7664  91853.57 -47518.8285 121022.64
## 140       37824.93 -21495.9838  97145.85 -52898.5794 128548.44
## 141       38897.96 -24744.8085 102540.73 -58435.2546 136231.17
## 142       39970.99 -28093.8506 108035.82 -64125.1991 144067.17
## 143       41044.01 -31540.8809 113628.91 -69965.0037 152053.03
## 144       42117.04 -35083.8135 119317.90 -75951.4781 160185.56
autoplot(hw3_f, fcol = "orange") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
accuracy(hw3_f, ekspor.test)
##                       ME     RMSE      MAE         MPE      MAPE     MASE
## Training set    19.04223 1492.772 1168.838  -0.2827387  8.418544 1.127002
## Test set     -7964.65162 9317.053 7964.652 -35.3013306 35.301331 7.679572
##                    ACF1 Theil's U
## Training set -0.4629315        NA
## Test set      0.7401520  3.492928

Double Exponential Smoothing dengan Alpha dan Beta Optimum

hw4<-HoltWinters(ekspor.training, gamma = FALSE) 
hw4
## Holt-Winters exponential smoothing with trend and without seasonal component.
## 
## Call:
## HoltWinters(x = ekspor.training, gamma = FALSE)
## 
## Smoothing parameters:
##  alpha: 0.4859005
##  beta : 0.02647358
##  gamma: FALSE
## 
## Coefficients:
##          [,1]
## a 15510.77811
## b    34.92248
head(hw4$fitted)
## Time Series:
## Start = 3 
## End = 8 
## Frequency = 1 
##       xhat    level      trend
## 3 14224.40 14415.30 -190.90000
## 4 15101.65 15265.00 -163.35147
## 5 15662.78 15807.45 -144.66659
## 6 16827.18 16938.08 -110.90472
## 7 17494.21 17585.05  -90.84121
## 8 17365.61 17457.42  -91.81507
# forecast
hw4_f<-forecast(hw4, h=24)
hw4_f
##     Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
## 121       15545.70 14092.15 16999.26 13322.679 17768.72
## 122       15580.62 13956.30 17204.94 13096.437 18064.81
## 123       15615.55 13829.07 17402.02 12883.373 18347.72
## 124       15650.47 13708.12 17592.81 12679.910 18621.03
## 125       15685.39 13591.88 17778.90 12483.646 18887.13
## 126       15720.31 13479.24 17961.39 12292.886 19147.74
## 127       15755.24 13369.38 18141.09 12106.385 19404.09
## 128       15790.16 13261.69 18318.63 11923.198 19657.12
## 129       15825.08 13155.69 18494.47 11742.595 19907.57
## 130       15860.00 13050.99 18669.01 11563.996 20156.01
## 131       15894.93 12947.31 18842.54 11386.935 20402.92
## 132       15929.85 12844.38 19015.32 11211.032 20648.66
## 133       15964.77 12742.00 19187.54 11035.971 20893.57
## 134       15999.69 12640.00 19359.38 10861.492 21137.89
## 135       16034.62 12538.24 19530.99 10687.371 21381.86
## 136       16069.54 12436.59 19702.49 10513.422 21625.65
## 137       16104.46 12334.95 19873.98 10339.484 21869.44
## 138       16139.38 12233.22 20045.55 10165.420 22113.35
## 139       16174.31 12131.33 20217.28  9991.109 22357.50
## 140       16209.23 12029.21 20389.24  9816.448 22602.01
## 141       16244.15 11926.81 20561.49  9641.346 22846.95
## 142       16279.07 11824.06 20734.08  9465.725 23092.42
## 143       16314.00 11720.93 20907.06  9289.514 23338.48
## 144       16348.92 11617.38 21080.46  9112.652 23585.18
autoplot(hw4_f, fcol = "orange") +
  autolayer(ekspor.training, series = "Actual", color = "black")

# accuracy
akurasi.hw4<-accuracy(hw4_f, ekspor.test)
akurasi.hw4
##                     ME     RMSE       MAE        MPE     MAPE      MASE
## Training set  148.7733 1139.156  916.0666  0.5372984  6.55117 0.8832778
## Test set     5865.2617 6773.769 5913.2970 24.9174875 25.23201 5.7016417
##                     ACF1 Theil's U
## Training set -0.09813519        NA
## Test set      0.66920013  2.590961

Kesimpulan

Nilai Alpha dan Beta optimum pada Double exponential smoothing adalah 0.4859005 dan 0.02647358, nilai ini menghasilkan ukuran keakuratan ramalan terbaik dibandingkan dengan Double exponential smoothing alpha dan Beta 0.25, 0.50, dan 0.75.

Perbanding Single dan Double Exponential Smoothing

## Single Exponential Smoothing
akurasi.holtw4
##                      ME     RMSE       MAE        MPE      MAPE      MASE
## Training set   15.07999 1112.061  885.1377 -0.4082788  6.346038 0.8534559
## Test set     6383.66237 7323.211 6409.3221 27.1941081 27.362119 6.1799126
##                     ACF1 Theil's U
## Training set -0.08211838        NA
## Test set      0.69356234  2.799194
## Double Exponential Smoothing
akurasi.hw4
##                     ME     RMSE       MAE        MPE     MAPE      MASE
## Training set  148.7733 1139.156  916.0666  0.5372984  6.55117 0.8832778
## Test set     5865.2617 6773.769 5913.2970 24.9174875 25.23201 5.7016417
##                     ACF1 Theil's U
## Training set -0.09813519        NA
## Test set      0.66920013  2.590961

Kesimpulan

Berdasarkan hasil di atas dapat disimpulkan bahwa metode Double Exponential Smoothing lebih baik dalam meramalkan data hasil ekspor bulanan di Indonesia karena metode ini memiliki nilai RMSE, MAE, dan MAPE yang lebih kecil dibandingkan dengan Single Exponential Smoothing.

Hasil Ramalan Hasil Ekspor Menggunakan Double Exponential Smoothing

# forecast
hw4_f<-forecast(hw4, h=30)
hw4_f
##     Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
## 121       15545.70 14092.15 16999.26 13322.679 17768.72
## 122       15580.62 13956.30 17204.94 13096.437 18064.81
## 123       15615.55 13829.07 17402.02 12883.373 18347.72
## 124       15650.47 13708.12 17592.81 12679.910 18621.03
## 125       15685.39 13591.88 17778.90 12483.646 18887.13
## 126       15720.31 13479.24 17961.39 12292.886 19147.74
## 127       15755.24 13369.38 18141.09 12106.385 19404.09
## 128       15790.16 13261.69 18318.63 11923.198 19657.12
## 129       15825.08 13155.69 18494.47 11742.595 19907.57
## 130       15860.00 13050.99 18669.01 11563.996 20156.01
## 131       15894.93 12947.31 18842.54 11386.935 20402.92
## 132       15929.85 12844.38 19015.32 11211.032 20648.66
## 133       15964.77 12742.00 19187.54 11035.971 20893.57
## 134       15999.69 12640.00 19359.38 10861.492 21137.89
## 135       16034.62 12538.24 19530.99 10687.371 21381.86
## 136       16069.54 12436.59 19702.49 10513.422 21625.65
## 137       16104.46 12334.95 19873.98 10339.484 21869.44
## 138       16139.38 12233.22 20045.55 10165.420 22113.35
## 139       16174.31 12131.33 20217.28  9991.109 22357.50
## 140       16209.23 12029.21 20389.24  9816.448 22602.01
## 141       16244.15 11926.81 20561.49  9641.346 22846.95
## 142       16279.07 11824.06 20734.08  9465.725 23092.42
## 143       16314.00 11720.93 20907.06  9289.514 23338.48
## 144       16348.92 11617.38 21080.46  9112.652 23585.18
## 145       16383.84 11513.36 21254.32  8935.085 23832.60
## 146       16418.76 11408.85 21428.67  8756.765 24080.76
## 147       16453.69 11303.82 21603.55  8577.649 24329.72
## 148       16488.61 11198.25 21778.97  8397.699 24579.52
## 149       16523.53 11092.10 21954.96  8216.882 24830.18
## 150       16558.45 10985.38 22131.53  8035.167 25081.74
autoplot(hw4_f, fcol = "pink") +
  autolayer(ekspor.training, series = "Actual", color = "black")