library(readxl)
datainflow <- read_excel(path = "Inflowup.xlsx")
dataoutflow <- read_excel(path = "outflowup.xlsx")
datainflowtahun <- datainflow[c(1:11),c(1:19)]
datainflowtahun
## # A tibble: 11 x 19
## Tahun Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau `Kep. Riau`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2011 57900. 2308. 23238. 9385. 3012. 1426.
## 2 2012 65911. 2620. 25981. 11192. 4447. 2236.
## 3 2013 98369. 36337. 18120. 14056. 8933. 3378.
## 4 2014 86024. 4567. 30503. 14103. 6358. 2563.
## 5 2015 86549. 4710. 30254. 13309. 7156. 3218.
## 6 2016 97764. 5775. 34427. 14078. 8211. 4317.
## 7 2017 103748. 5514. 35617. 15312. 8553. 4412.
## 8 2018 117495. 5799. 41769. 15058. 10730. 5134.
## 9 2019 133762. 7509. 47112. 14750. 10915. 6077.
## 10 2020 109345. 6641. 36609. 10696. 9148. 6175.
## 11 2021 89270. 3702. 31840. 10748. 7769. 5009.
## # ... with 12 more variables: Jambi <dbl>, Sumatera Selatan <dbl>,
## # Bengkulu <dbl>, Lampung <dbl>, Kep. Bangka Belitung <dbl>,
## # DKI Jakarta <dbl>, Jawa <dbl>, Jawa Barat <dbl>, Jawa Tengah <dbl>,
## # Yogyakarta <dbl>, Jawa Timur <dbl>, Banten <dbl>
dataoutflowtahun <- dataoutflow[c(1:11),c(1:19)]
dataoutflowtahun
## # A tibble: 11 x 19
## Tahun Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau `Kep. Riau`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2011 80092. 6338. 22176. 5300. 12434. 5819.
## 2 2012 85235. 6378. 22495. 6434. 13014. 6966.
## 3 2013 103288. 23278. 19235. 6511. 15460. 8747.
## 4 2014 102338. 8630. 26391. 7060. 15158. 10122.
## 5 2015 109186. 9637. 27877. 7471. 15789. 9803.
## 6 2016 121992. 11311. 31959. 9198. 17645. 10068.
## 7 2017 133606. 11760. 35243. 10754. 18128. 10749.
## 8 2018 135676. 11450. 36908. 8447. 17926. 12597.
## 9 2019 153484. 13087. 44051. 9465. 19277. 12644.
## 10 2020 140589. 12874. 39758. 8763. 19139. 8461.
## 11 2021 86627. 5770. 23453. 5941. 12631. 5128.
## # ... with 12 more variables: Jambi <dbl>, Sumatera Selatan <dbl>,
## # Bengkulu <dbl>, Lampung <dbl>, Kep. Bangka Belitung <dbl>,
## # DKI Jakarta <dbl>, Jawa <dbl>, Jawa Barat <dbl>, Jawa Tengah <dbl>,
## # Yogyakarta <dbl>, Jawa Timur <dbl>, Banten <dbl>
datainjawatimur <- datainflowtahun$`Jawa Timur`
dataoutjawatimur <- dataoutflowtahun$`Jawa Timur`
plot(datainjawatimur, type = "l", col = "red")
plot(dataoutjawatimur, type = "l", col = "blue")
plot(datainjawatimur, type = "l", col = "red")
lines(dataoutjawatimur, type = "l", col = "blue")
datainflowbulan <- datainflow[c(12:139),c(1:19)]
datainflowbulan
## # A tibble: 128 x 19
## Tahun Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau `Kep. Riau`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 01/01/20~ 4164. 124. 2068. 545. 94.2 84.2
## 2 01/02/20~ 3338. 115. 1826. 450. 96.4 45.3
## 3 01/03/20~ 4878. 154. 2028. 849. 288. 87.2
## 4 01/04/20~ 3157. 122. 1429. 539. 160. 106.
## 5 01/05/20~ 3821. 123. 1539. 692. 195. 79.4
## 6 01/06/20~ 3686. 151. 1637. 592. 101. 79.4
## 7 01/07/20~ 4370. 107. 1791. 800. 143. 121.
## 8 01/08/20~ 3668. 184. 1256. 586. 134. 64.6
## 9 01/09/20~ 12875. 606. 4172. 2176. 1014. 370.
## 10 01/10/20~ 4777. 158. 1941. 787. 341. 127.
## # ... with 118 more rows, and 12 more variables: Jambi <dbl>,
## # Sumatera Selatan <dbl>, Bengkulu <dbl>, Lampung <dbl>,
## # Kep. Bangka Belitung <dbl>, DKI Jakarta <dbl>, Jawa <dbl>,
## # Jawa Barat <dbl>, Jawa Tengah <dbl>, Yogyakarta <dbl>, Jawa Timur <dbl>,
## # Banten <dbl>
dataoutflowbulan <- dataoutflow[c(12:139),c(1:19)]
dataoutflowbulan
## # A tibble: 128 x 19
## Tahun Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau `Kep. Riau`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 01/01/2011 3442. 350. 941. 307. 478. 189.
## 2 01/02/2011 3989. 193. 990. 228. 400. 268.
## 3 01/03/2011 4229. 230. 1209. 347. 621. 209.
## 4 01/04/2011 6721. 529. 1653. 336. 1006. 364.
## 5 01/05/2011 5787. 523. 1465. 328. 1000. 448.
## 6 01/06/2011 7395. 406. 2167. 399. 1366. 516.
## 7 01/07/2011 7154. 958. 1695. 449. 815. 584.
## 8 01/08/2011 16043. 1046. 4104. 1376. 2729. 1312.
## 9 01/09/2011 1915. 124. 824. 148. 154. 99.2
## 10 01/10/2011 5174. 634. 1392. 299. 830. 270.
## # ... with 118 more rows, and 12 more variables: Jambi <dbl>,
## # Sumatera Selatan <dbl>, Bengkulu <dbl>, Lampung <dbl>,
## # Kep. Bangka Belitung <dbl>, DKI Jakarta <dbl>, Jawa <dbl>,
## # Jawa Barat <dbl>, Jawa Tengah <dbl>, Yogyakarta <dbl>, Jawa Timur <dbl>,
## # Banten <dbl>
plot(datainflowbulan$`Jawa Timur`, type = "l", col = "red")
lines(dataoutflowbulan$`Jawa Timur`,col="green")
legend("top",c("Inflow","Outflow"),fill=c("red","green"))
jatimtimeseries <- datainflowbulan$`Jawa Timur`
plot.ts(jatimtimeseries , type = "l", col = "red")
logjawatimur <- log(datainflowbulan$`Jawa Timur`)
plot.ts(logjawatimur)
library("TTR")
jawatimurSMA3 <- SMA(datainflowbulan$`Jawa Timur`,n=3)
plot.ts(jawatimurSMA3 )
library("TTR")
jawatimurSMA3 <- SMA(datainflowbulan$`Jawa Timur`,n=8)
plot.ts(jawatimurSMA3 )
jatiminflowtimeseries <- ts(datainflowbulan$`Jawa Timur`, frequency=12, start=c(2011,1))
jatiminflowtimeseries
## Jan Feb Mar Apr May Jun Jul
## 2011 3071.011 2932.262 3054.203 2381.178 2418.761 1998.229 2329.895
## 2012 5551.676 4091.862 3249.951 3193.361 3851.132 2673.787 3945.991
## 2013 6189.613 3389.515 2937.854 3256.841 3189.894 2975.463 3470.218
## 2014 8821.191 5411.171 3789.147 3889.709 3960.321 4229.178 1784.529
## 2015 9302.214 4610.568 4528.315 4299.768 5006.318 4808.087 10719.480
## 2016 9802.295 7060.086 5170.786 4770.902 6282.794 4496.823 14403.892
## 2017 10336.152 6777.860 6750.998 6386.411 7526.697 3332.357 19702.729
## 2018 13187.621 7417.607 6096.684 7509.484 6441.516 15185.729 12618.539
## 2019 13282.646 7529.556 7036.191 7362.127 6503.036 19381.085 9575.539
## 2020 14488.880 8426.676 6497.389 6243.143 7031.218 9908.713 5461.708
## 2021 14673.916 7171.052 5813.241 5305.827 11546.156 6446.963 2922.981
## Aug Sep Oct Nov Dec
## 2011 1886.602 8767.383 3314.239 3747.879 2613.509
## 2012 5367.956 5415.970 3291.799 4143.024 2606.021
## 2013 7713.398 4588.796 4117.679 4097.263 2760.064
## 2014 14339.480 4988.205 5031.002 4545.631 3486.724
## 2015 6885.894 4549.856 5109.469 5009.577 3978.902
## 2016 7197.173 5917.749 6556.520 5873.714 5905.975
## 2017 8271.746 7553.481 7754.196 7510.503 6477.016
## 2018 8495.113 7821.194 8461.978 7774.122 5423.020
## 2019 8845.822 7792.708 9314.393 8651.688 8375.968
## 2020 6323.179 6604.377 5057.451 7289.093 3515.972
## 2021 5105.404
jatimoutflowtimeseries <- ts(dataoutflowbulan$`Jawa Timur`, frequency=12, start=c(2011,1))
jatimoutflowtimeseries
## Jan Feb Mar Apr May Jun
## 2011 622.2843 1161.2019 1818.9743 2548.3076 2202.0508 2881.6643
## 2012 972.6386 2107.9733 3537.5574 3385.7392 3330.3175 5276.1881
## 2013 1042.6989 1416.3046 1956.8638 1501.3800 2436.5230 2548.4787
## 2014 2292.6490 2337.3901 4341.3923 3259.1932 3762.0541 3671.3338
## 2015 1477.3586 2466.3076 3691.7979 6112.8089 3701.0538 7691.4778
## 2016 2028.4451 3699.0597 4496.5522 5539.6423 7636.9558 18111.9600
## 2017 2443.7613 4603.4441 7882.3392 6755.4780 8700.5238 22447.4045
## 2018 2578.4385 5969.9665 9790.7112 6163.5930 14484.9670 15809.8892
## 2019 2272.9352 5545.4638 8593.6906 9438.6568 24122.3944 2418.9280
## 2020 3789.6870 5644.7356 9175.4920 9057.1774 11911.2719 2584.3144
## 2021 1339.2973 4063.6639 5911.6155 12153.3435 10258.7903 3478.7340
## Jul Aug Sep Oct Nov Dec
## 2011 3703.3381 10065.1388 997.5488 2446.9332 2002.5094 4766.7289
## 2012 4999.0124 7700.9961 1600.9659 3363.9058 2929.6925 5283.8016
## 2013 5133.5144 3883.1844 2330.9637 4056.2800 3496.0878 6862.7322
## 2014 14441.2175 1421.8224 3508.4894 4449.9358 4017.4337 6428.3864
## 2015 13456.5557 2901.5841 5135.6666 3915.9097 4379.8290 8654.3655
## 2016 3438.6223 3697.4495 6212.4006 4866.6283 5763.2763 8999.8004
## 2017 2421.0292 8428.1973 5489.6827 5071.8714 8510.9058 10641.2201
## 2018 4579.9448 9148.7061 5728.7680 6591.1663 7346.6019 9802.3189
## 2019 7869.8703 8757.2044 6624.0955 6896.2513 8618.8669 14355.7462
## 2020 8544.1231 5712.7574 6949.3088 10935.1122 5170.0166 13900.2427
## 2021 5906.8317 2917.2180
plot.ts(jatimoutflowtimeseries)
plot.ts(jatiminflowtimeseries)
jawatimurintimeseriescomponents <- decompose(jatiminflowtimeseries)
jawatimurintimeseriescomponents$seasonal
## Jan Feb Mar Apr May Jun
## 2011 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2012 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2013 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2014 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2015 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2016 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2017 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2018 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2019 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2020 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## 2021 3956.04132 -434.86644 -1491.60992 -1394.72968 -1099.06353 791.28563
## Jul Aug Sep Oct Nov Dec
## 2011 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2012 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2013 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2014 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2015 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2016 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2017 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2018 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2019 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2020 2040.31129 1105.68863 -56.13335 -678.91480 -665.75481 -2072.25434
## 2021 2040.31129 1105.68863
jawatimurouttimeseriescomponents <- decompose(jatimoutflowtimeseries)
jawatimurouttimeseriescomponents$seasonal
## Jan Feb Mar Apr May Jun
## 2011 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2012 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2013 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2014 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2015 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2016 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2017 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2018 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2019 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2020 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## 2021 -4074.06921 -2291.82747 -32.32033 -349.47499 2804.60711 2800.31496
## Jul Aug Sep Oct Nov Dec
## 2011 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2012 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2013 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2014 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2015 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2016 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2017 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2018 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2019 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2020 983.48098 281.38109 -1461.68022 -717.14347 -826.61161 2883.34315
## 2021 983.48098 281.38109
plot(jawatimurintimeseriescomponents$seasonal,type = "l", col = "red")
lines(jawatimurouttimeseriescomponents$seasonal,col="green")
legend("top",c("Inflow","Outflow"),fill=c("red","green"))
plot(jawatimurintimeseriescomponents$trend,type = "l", col = "red")
lines(jawatimurouttimeseriescomponents$trend,col="green")
legend("top",c("Inflow","Outflow"),fill=c("red","green"))
plot(jawatimurintimeseriescomponents$random ,type = "l", col = "red")
lines(jawatimurouttimeseriescomponents$random,col="green")
legend("top",c("Inflow","Outflow"),fill=c("red","green"))
plot(jawatimurintimeseriescomponents$figure ,type = "l", col = "red")
lines(jawatimurouttimeseriescomponents$figure,col="green")
legend("top",c("Inflow","Outflow"),fill=c("red","green"))
jawatimurintimeseriesseasonallyadjusted <- jatimtimeseries - jawatimurintimeseriescomponents$seasonal
plot(jawatimurintimeseriesseasonallyadjusted)
jatimseriesforecasts <- HoltWinters(jatimtimeseries, beta=FALSE, gamma=FALSE)
jatimseriesforecasts
## Holt-Winters exponential smoothing without trend and without seasonal component.
##
## Call:
## HoltWinters(x = jatimtimeseries, beta = FALSE, gamma = FALSE)
##
## Smoothing parameters:
## alpha: 0.09988877
## beta : FALSE
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 7064.61
jatimseriesforecasts$fitted
## Time Series:
## Start = 2
## End = 128
## Frequency = 1
## xhat level
## 2 3071.011 3071.011
## 3 3057.151 3057.151
## 4 3056.857 3056.857
## 5 2989.364 2989.364
## 6 2932.367 2932.367
## 7 2839.057 2839.057
## 8 2788.198 2788.198
## 9 2698.138 2698.138
## 10 3304.388 3304.388
## 11 3305.372 3305.372
## 12 3349.573 3349.573
## 13 3276.049 3276.049
## 14 3503.358 3503.358
## 15 3562.143 3562.143
## 16 3530.959 3530.959
## 17 3497.236 3497.236
## 18 3532.587 3532.587
## 19 3446.802 3446.802
## 20 3496.666 3496.666
## 21 3683.586 3683.586
## 22 3856.632 3856.632
## 23 3800.212 3800.212
## 24 3834.455 3834.455
## 25 3711.748 3711.748
## 26 3959.259 3959.259
## 27 3902.348 3902.348
## 28 3806.006 3806.006
## 29 3751.150 3751.150
## 30 3695.087 3695.087
## 31 3623.205 3623.205
## 32 3607.923 3607.923
## 33 4018.014 4018.014
## 34 4075.029 4075.029
## 35 4079.289 4079.289
## 36 4081.084 4081.084
## 37 3949.129 3949.129
## 38 4435.794 4435.794
## 39 4533.223 4533.223
## 40 4458.898 4458.898
## 41 4402.042 4402.042
## 42 4357.919 4357.919
## 43 4345.060 4345.060
## 44 4089.291 4089.291
## 45 5113.170 5113.170
## 46 5100.687 5100.687
## 47 5093.727 5093.727
## 48 5038.978 5038.978
## 49 4883.925 4883.925
## 50 5325.263 5325.263
## 51 5253.873 5253.873
## 52 5181.398 5181.398
## 53 5093.333 5093.333
## 54 5084.641 5084.641
## 55 5057.016 5057.016
## 56 5622.633 5622.633
## 57 5748.818 5748.818
## 58 5629.056 5629.056
## 59 5577.155 5577.155
## 60 5520.460 5520.460
## 61 5366.476 5366.476
## 62 5809.564 5809.564
## 63 5934.477 5934.477
## 64 5858.193 5858.193
## 65 5749.585 5749.585
## 66 5802.847 5802.847
## 67 5672.390 5672.390
## 68 6544.569 6544.569
## 69 6609.757 6609.757
## 70 6540.633 6540.633
## 71 6542.220 6542.220
## 72 6475.443 6475.443
## 73 6418.560 6418.560
## 74 6809.883 6809.883
## 75 6806.685 6806.685
## 76 6801.122 6801.122
## 77 6759.697 6759.697
## 78 6836.312 6836.312
## 79 6486.306 6486.306
## 80 7806.478 7806.478
## 81 7852.953 7852.953
## 82 7823.039 7823.039
## 83 7816.163 7816.163
## 84 7785.631 7785.631
## 85 7654.915 7654.915
## 86 8207.570 8207.570
## 87 8128.662 8128.662
## 88 7925.690 7925.690
## 89 7884.116 7884.116
## 90 7740.016 7740.016
## 91 8483.759 8483.759
## 92 8896.777 8896.777
## 93 8856.656 8856.656
## 94 8753.225 8753.225
## 95 8724.132 8724.132
## 96 8629.237 8629.237
## 97 8308.972 8308.972
## 98 8805.786 8805.786
## 99 8678.305 8678.305
## 100 8514.276 8514.276
## 101 8399.190 8399.190
## 102 8209.785 8209.785
## 103 9325.673 9325.673
## 104 9350.631 9350.631
## 105 9300.207 9300.207
## 106 9149.624 9149.624
## 107 9166.083 9166.083
## 108 9114.701 9114.701
## 109 9040.910 9040.910
## 110 9585.101 9585.101
## 111 9469.387 9469.387
## 112 9172.518 9172.518
## 113 8879.906 8879.906
## 114 8695.243 8695.243
## 115 8816.455 8816.455
## 116 8481.354 8481.354
## 117 8265.776 8265.776
## 118 8099.821 8099.821
## 119 7795.922 7795.922
## 120 7745.296 7745.296
## 121 7322.834 7322.834
## 122 8057.124 8057.124
## 123 7968.616 7968.616
## 124 7753.318 7753.318
## 125 7508.841 7508.841
## 126 7912.124 7912.124
## 127 7765.770 7765.770
## 128 7282.030 7282.030
plot(jatimseriesforecasts)
jatimseriesforecasts$SSE
## [1] 1087163799
jatimseriesforecasts <- HoltWinters(jawatimurintimeseriescomponents$seasonal, beta=FALSE, gamma=FALSE)
jatimseriesforecasts
## Holt-Winters exponential smoothing without trend and without seasonal component.
##
## Call:
## HoltWinters(x = jawatimurintimeseriescomponents$seasonal, beta = FALSE, gamma = FALSE)
##
## Smoothing parameters:
## alpha: 0.1516967
## beta : FALSE
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 281.6174
jatimseriesforecasts$fitted
## xhat level
## Feb 2011 3956.041325 3956.041325
## Mar 2011 3289.955114 3289.955114
## Apr 2011 2564.607485 2564.607485
## May 2011 1963.989110 1963.989110
## Jun 2011 1499.334137 1499.334137
## Jul 2011 1391.925517 1391.925517
## Aug 2011 1490.283498 1490.283498
## Sep 2011 1431.941726 1431.941726
## Oct 2011 1206.205650 1206.205650
## Nov 2011 920.239102 920.239102
## Dec 2011 679.649062 679.649062
## Jan 2012 262.194401 262.194401
## Feb 2012 822.538784 822.538784
## Mar 2012 631.794562 631.794562
## Apr 2012 309.681113 309.681113
## May 2012 51.127624 51.127624
## Jun 2012 -123.352577 -123.352577
## Jul 2012 15.395019 15.395019
## Aug 2012 322.568132 322.568132
## Sep 2012 441.364926 441.364926
## Oct 2012 365.896080 365.896080
## Nov 2012 207.401719 207.401719
## Dec 2012 74.946757 74.946757
## Jan 2013 -250.776561 -250.776561
## Feb 2013 387.383823 387.383823
## Mar 2013 262.651172 262.651172
## Apr 2013 -3.464444 -3.464444
## May 2013 -214.514786 -214.514786
## Jun 2013 -348.697910 -348.697910
## Jul 2013 -175.766171 -175.766171
## Aug 2013 160.405464 160.405464
## Sep 2013 303.801798 303.801798
## Oct 2013 249.200825 249.200825
## Nov 2013 108.408749 108.408749
## Dec 2013 -9.029307 -9.029307
## Jan 2014 -322.013733 -322.013733
## Feb 2014 326.953095 326.953095
## Mar 2014 211.387586 211.387586
## Apr 2014 -46.951513 -46.951513
## May 2014 -251.405011 -251.405011
## Jun 2014 -379.992010 -379.992010
## Jul 2014 -202.313058 -202.313058
## Aug 2014 137.885651 137.885651
## Sep 2014 284.698167 284.698167
## Oct 2014 232.995151 232.995151
## Nov 2014 94.661423 94.661423
## Dec 2014 -20.691209 -20.691209
## Jan 2015 -331.906563 -331.906563
## Feb 2015 318.560974 318.560974
## Mar 2015 204.268523 204.268523
## Apr 2015 -52.990638 -52.990638
## May 2015 -256.528020 -256.528020
## Jun 2015 -384.337876 -384.337876
## Jul 2015 -205.999671 -205.999671
## Aug 2015 134.758286 134.758286
## Sep 2015 282.045212 282.045212
## Oct 2015 230.744641 230.744641
## Nov 2015 92.752307 92.752307
## Dec 2015 -22.310718 -22.310718
## Jan 2016 -333.280398 -333.280398
## Feb 2016 317.395546 317.395546
## Mar 2016 203.279886 203.279886
## Apr 2016 -53.829302 -53.829302
## May 2016 -257.239462 -257.239462
## Jun 2016 -384.941394 -384.941394
## Jul 2016 -206.511637 -206.511637
## Aug 2016 134.323983 134.323983
## Sep 2016 281.676792 281.676792
## Oct 2016 230.432109 230.432109
## Nov 2016 92.487185 92.487185
## Dec 2016 -22.535622 -22.535622
## Jan 2017 -333.471185 -333.471185
## Feb 2017 317.233701 317.233701
## Mar 2017 203.142592 203.142592
## Apr 2017 -53.945769 -53.945769
## May 2017 -257.338261 -257.338261
## Jun 2017 -385.025205 -385.025205
## Jul 2017 -206.582735 -206.582735
## Aug 2017 134.263670 134.263670
## Sep 2017 281.625629 281.625629
## Oct 2017 230.388707 230.388707
## Nov 2017 92.450367 92.450367
## Dec 2017 -22.566855 -22.566855
## Jan 2018 -333.497679 -333.497679
## Feb 2018 317.211225 317.211225
## Mar 2018 203.123526 203.123526
## Apr 2018 -53.961943 -53.961943
## May 2018 -257.351981 -257.351981
## Jun 2018 -385.036844 -385.036844
## Jul 2018 -206.592608 -206.592608
## Aug 2018 134.255295 134.255295
## Sep 2018 281.618524 281.618524
## Oct 2018 230.382680 230.382680
## Nov 2018 92.445254 92.445254
## Dec 2018 -22.571192 -22.571192
## Jan 2019 -333.501359 -333.501359
## Feb 2019 317.208104 317.208104
## Mar 2019 203.120878 203.120878
## Apr 2019 -53.964189 -53.964189
## May 2019 -257.353887 -257.353887
## Jun 2019 -385.038461 -385.038461
## Jul 2019 -206.593980 -206.593980
## Aug 2019 134.254132 134.254132
## Sep 2019 281.617537 281.617537
## Oct 2019 230.381843 230.381843
## Nov 2019 92.444544 92.444544
## Dec 2019 -22.571794 -22.571794
## Jan 2020 -333.501870 -333.501870
## Feb 2020 317.207670 317.207670
## Mar 2020 203.120510 203.120510
## Apr 2020 -53.964501 -53.964501
## May 2020 -257.354151 -257.354151
## Jun 2020 -385.038685 -385.038685
## Jul 2020 -206.594170 -206.594170
## Aug 2020 134.253970 134.253970
## Sep 2020 281.617400 281.617400
## Oct 2020 230.381726 230.381726
## Nov 2020 92.444446 92.444446
## Dec 2020 -22.571878 -22.571878
## Jan 2021 -333.501941 -333.501941
## Feb 2021 317.207610 317.207610
## Mar 2021 203.120459 203.120459
## Apr 2021 -53.964544 -53.964544
## May 2021 -257.354188 -257.354188
## Jun 2021 -385.038716 -385.038716
## Jul 2021 -206.594196 -206.594196
## Aug 2021 134.253948 134.253948
plot(jatimseriesforecasts)
jatimseriesforecasts$SSE
## [1] 451197402
library(forecast)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
dftimeseries.hw <- HoltWinters(jatimtimeseries, gamma=FALSE)
## Warning in HoltWinters(jatimtimeseries, gamma = FALSE): optimization
## difficulties: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH
jawatimurtimeserieforecasts2 <-forecast(dftimeseries.hw,h=20)
jawatimurtimeserieforecasts2
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 129 5475.372 1777.62368 9173.121 -179.8462 11130.591
## 130 5265.308 1564.79659 8965.820 -394.1360 10924.753
## 131 5055.244 1348.87851 8761.610 -613.1531 10723.642
## 132 4845.180 1128.73806 8561.623 -838.6277 10528.989
## 133 4635.117 903.26823 8366.965 -1072.2529 10342.486
## 134 4425.053 671.40003 8178.705 -1315.6636 10165.769
## 135 4214.989 432.11829 7997.859 -1570.4123 10000.390
## 136 4004.925 184.47839 7825.371 -1837.9437 9847.793
## 137 3794.861 -72.37727 7662.099 -2119.5694 9709.291
## 138 3584.797 -339.20425 7508.798 -2416.4450 9586.039
## 139 3374.733 -616.64408 7366.110 -2729.5514 9479.017
## 140 3164.669 -905.21599 7234.554 -3059.6830 9389.021
## 141 2954.605 -1205.31338 7114.524 -3407.4412 9316.651
## 142 2744.541 -1517.20499 7006.287 -3773.2371 9262.319
## 143 2534.477 -1841.04060 6909.995 -4157.2998 9226.254
## 144 2324.413 -2176.86056 6825.687 -4559.6910 9208.518
## 145 2114.349 -2524.60817 6753.307 -4980.3240 9209.023
## 146 1904.285 -2884.14385 6692.715 -5418.9852 9227.556
## 147 1694.222 -3255.25996 6643.703 -5875.3572 9263.800
## 148 1484.158 -3637.69549 6606.011 -6349.0407 9317.356
plot(jawatimurtimeserieforecasts2)
jatimtimeseriesdiff1<-diff(jatimtimeseries, difference=1)
plot.ts(jatimtimeseriesdiff1)
acf(jatimtimeseriesdiff1, lag.max=20) # plot correlogram
acf(jatimtimeseriesdiff1,lag.max=20, plot=FALSE) #to get the partial autocorrelation values
##
## Autocorrelations of series 'jatimtimeseriesdiff1', by lag
##
## 0 1 2 3 4 5 6 7 8 9 10
## 1.000 -0.512 0.026 -0.046 -0.027 0.034 0.058 0.071 -0.110 0.025 -0.131
## 11 12 13 14 15 16 17 18 19 20
## -0.080 0.520 -0.342 0.019 -0.014 -0.064 0.037 0.115 0.013 -0.103
pacf(jatimtimeseriesdiff1,lag.max=20) #plot partial correlogram
pacf(jatimtimeseriesdiff1,lag.max=20,plot=FALSE) # get partial auto correlation value
##
## Partial autocorrelations of series 'jatimtimeseriesdiff1', by lag
##
## 1 2 3 4 5 6 7 8 9 10 11
## -0.512 -0.320 -0.290 -0.326 -0.322 -0.242 -0.017 0.008 0.087 -0.109 -0.567
## 12 13 14 15 16 17 18 19 20
## 0.053 0.136 0.085 0.165 0.047 -0.076 -0.023 0.005 0.035
jatimtimeseriesarima<-arima(jatimtimeseries, order=c(0,1,1))
jatimtimeseriesarima
##
## Call:
## arima(x = jatimtimeseries, order = c(0, 1, 1))
##
## Coefficients:
## ma1
## -0.8972
## s.e. 0.0303
##
## sigma^2 estimated as 8557623: log likelihood = -1194.63, aic = 2393.26
library("forecast") # load the "forecast" R library
jatimtimeseriesforecastsar <- forecast(jatimtimeseriesarima, h=15)
jatimtimeseriesforecastsar
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 129 7036.183 3287.206 10785.16 1302.6184 12769.75
## 130 7036.183 3267.445 10804.92 1272.3957 12799.97
## 131 7036.183 3247.786 10824.58 1242.3308 12830.03
## 132 7036.183 3228.230 10844.14 1212.4210 12859.94
## 133 7036.183 3208.773 10863.59 1182.6640 12889.70
## 134 7036.183 3189.414 10882.95 1153.0576 12919.31
## 135 7036.183 3170.152 10902.21 1123.5994 12948.77
## 136 7036.183 3150.986 10921.38 1094.2873 12978.08
## 137 7036.183 3131.914 10940.45 1065.1190 13007.25
## 138 7036.183 3112.935 10959.43 1036.0926 13036.27
## 139 7036.183 3094.047 10978.32 1007.2059 13065.16
## 140 7036.183 3075.249 10997.12 978.4569 13093.91
## 141 7036.183 3056.539 11015.83 949.8437 13122.52
## 142 7036.183 3037.918 11034.45 921.3645 13151.00
## 143 7036.183 3019.383 11052.98 893.0172 13179.35
plot(jatimtimeseriesforecastsar)
acf(jatimtimeseriesforecastsar$residuals, lag.max=20)
Box.test(jatimtimeseriesforecastsar$residuals, lag=20, type="Ljung-Box")
##
## Box-Ljung test
##
## data: jatimtimeseriesforecastsar$residuals
## X-squared = 83.232, df = 20, p-value = 1.103e-09
Daftar pustaka :