Inflows adalah uang yang masuk ke Bank Indonesia melalui kegiatan penyetoran, dan Outflows adalah uang yang keluar dari Bank Indonesia melalui kegiatan penarikan. Setiap daerah memiliki prediksi data inflow-outflow uang kartal yang berbeda-beda. Berikut komparasi visualisasi prediksi data inflow-outflow uang kartal di Sumatera dan Sekitarnya menggunakan bahasa pemrograman R pada Rstudio.
library(readxl)
## Warning: package 'readxl' was built under R version 4.1.2
datainflow <- read_excel(path = "C:/Users/shafira halmahera/Documents/LINEAR ALGEBRA/Data Inflow Sumatra.xlsx")
datainflowtahun <- datainflow[c(1:12),c(1:12)]
datainflowtahun
## # A tibble: 12 x 12
## Tahun Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau `Kep. Riau`
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2012 65911. 2620. 25981. 11192. 4447. 2236.
## 2 2013 98369. 36337. 18120. 14056. 8933. 3378.
## 3 2014 86024. 4567. 30503. 14103. 6358. 2563.
## 4 2015 86549. 4710. 30254. 13309. 7156. 3218.
## 5 2016 97764. 5775. 34427. 14078. 8211. 4317.
## 6 2017 103748. 5514. 35617. 15312. 8553. 4412.
## 7 2018 117495. 5799. 41769. 15058. 10730. 5134.
## 8 2019 133762. 7509. 47112. 14750. 10915. 6077.
## 9 2020 109345. 6641. 36609. 10696. 9148. 6175.
## 10 2021 89270. 3702. 31840. 10748. 7769. 5009.
## 11 NA NA NA NA NA NA NA
## 12 NA NA NA NA NA NA NA
## # ... with 5 more variables: Jambi <dbl>, `Sumatera Selatan` <dbl>,
## # Bengkulu <dbl>, Lampung <dbl>, `Kep. Bangka Belitung` <dbl>
library(readxl)
dataoutflow <- read_excel(path = "C:/Users/shafira halmahera/Documents/LINEAR ALGEBRA/Data Outflow Sumatra.xlsx")
dataoutflowtahun <- dataoutflow[c(1:12),c(1:12)]
dataoutflowtahun
## # A tibble: 12 x 12
## Tahun Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau `Kep. Riau`
## <dbl> <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.
## 12 NA NA NA NA NA NA NA
## # ... with 5 more variables: Jambi <dbl>, `Sumatera Selatan` <dbl>,
## # Bengkulu <dbl>, Lampung <dbl>, `Kep. Bangka Belitung` <dbl>
library(readxl)
datainflowperbulan <- read_excel(path = 'C:/Users/shafira halmahera/Documents/LINEAR ALGEBRA/DataPerbulanInflow.xlsx')
datainflowperbulan
## # A tibble: 128 x 12
## Bulan Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau
## <dttm> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2011-01-01 00:00:00 4164. 124. 2068. 545. 94.2
## 2 2011-02-01 00:00:00 3338. 115. 1826. 450. 96.4
## 3 2011-03-01 00:00:00 4878. 154. 2028. 849. 288.
## 4 2011-04-01 00:00:00 3157. 122. 1429. 539. 160.
## 5 2011-05-01 00:00:00 3821. 123. 1539. 692. 195.
## 6 2011-06-01 00:00:00 3686. 151. 1637. 592. 101.
## 7 2011-07-01 00:00:00 4370. 107. 1791. 800. 143.
## 8 2011-08-01 00:00:00 3668. 184. 1256. 586. 134.
## 9 2011-09-01 00:00:00 12875. 606. 4172. 2176. 1014.
## 10 2011-10-01 00:00:00 4777. 158. 1941. 787. 341.
## # ... with 118 more rows, and 6 more variables: `Kep. Riau` <dbl>, Jambi <dbl>,
## # `Sumatera Selatan` <dbl>, Bengkulu <dbl>, Lampung <dbl>,
## # `Kep. Bangka Belitung` <dbl>
dataoutflowperbulan <- read_excel(path = 'C:/Users/shafira halmahera/Documents/LINEAR ALGEBRA/DataPerbulanOutflow.xlsx')
dataoutflowperbulan
## # A tibble: 128 x 12
## Bulan Sumatera Aceh `Sumatera Utara` `Sumatera Barat` Riau
## <dttm> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2011-01-01 00:00:00 3442. 350. 941. 307. 478.
## 2 2011-02-01 00:00:00 3989. 193. 990. 228. 400.
## 3 2011-03-01 00:00:00 4229. 230. 1209. 347. 621.
## 4 2011-04-01 00:00:00 6721. 529. 1653. 336. 1006.
## 5 2011-05-01 00:00:00 5787. 523. 1465. 328. 1000.
## 6 2011-06-01 00:00:00 7395. 406. 2167. 399. 1366.
## 7 2011-07-01 00:00:00 7154. 958. 1695. 449. 815.
## 8 2011-08-01 00:00:00 16043. 1046. 4104. 1376. 2729.
## 9 2011-09-01 00:00:00 1915. 124. 824. 148. 154.
## 10 2011-10-01 00:00:00 5174. 634. 1392. 299. 830.
## # ... with 118 more rows, and 6 more variables: `Kep. Riau` <dbl>, Jambi <dbl>,
## # `Sumatera Selatan` <dbl>, Bengkulu <dbl>, Lampung <dbl>,
## # `Kep. Bangka Belitung` <dbl>
plot(datainflowtahun$Tahun, datainflowtahun$`Aceh`, type = "l", col = "red", main = 'Data Inflow-Outflow Uang Kartal di Aceh Setiap Tahun', xlab = 'Tahun Periode', ylab = 'Data Inflow-Outflow') lines(dataoutflowtahun$Tahun, dataoutflowtahun$`Aceh`, col = 'Green' ) legend('top', c("Inflow","Outlow"),fill=c("red","purple") )
plot(datainflowperbulan$Bulan, datainflowperbulan$`Aceh`, type = "l", col = "steelblue", main = 'Data Inflow-Outflow Uang Kartal di Aceh Setiap Bulan', xlab = 'Bulan', ylab = 'Data Inflow-Outflow') lines(dataoutflowperbulan$Bulan, dataoutflowperbulan$`Aceh`, col = 'purple') legend('right',c('Inflow','Outflow'),fill = c('steelblue','purple'))
Acehtimeseries <- datainflowperbulan$`Aceh` plot.ts(Acehtimeseries, type = "l", col = "red")
logAceh <- dataoutflowperbulan$`Aceh` plot.ts(logAceh, type = "l", col = "blue")
library(TTR)
## Warning: package 'TTR' was built under R version 4.1.2
AcehSMA3 <- SMA(datainflowperbulan$`Aceh`, n = 3)
plot.ts(AcehSMA3)
library('TTR')
AcehSMA3 <- SMA(datainflowperbulan$`Aceh`, n = 8)
plot.ts(AcehSMA3)
Acehinflowts <- ts(datainflowperbulan$`Aceh`, frequency = 12, start = c(2011,1)) Acehinflowts
## Jan Feb Mar Apr May Jun ## 2011 122.18349 122.75253 151.37534 107.22432 183.84525 605.62334 ## 2012 139.33374 167.56600 119.32971 196.61835 420.06418 286.31394 ## 2013 3775.08977 3705.38033 3449.77565 3456.32173 8516.17096 243.91990 ## 2014 260.82180 168.17801 194.97802 173.99322 1306.11875 271.45458 ## 2015 263.06848 256.64615 398.59527 977.94399 495.56495 179.23767 ## 2016 218.98473 298.46423 450.32018 1374.47417 310.75050 538.99459 ## 2017 240.71874 299.60563 194.84441 1149.75614 264.01934 627.70230 ## 2018 262.95066 288.49282 1005.08498 784.64208 369.23511 426.04458 ## 2019 342.84300 420.44274 1554.92585 473.28934 684.81679 405.51614 ## 2020 281.42142 489.21304 1095.11262 257.81810 592.86464 410.39330 ## 2021 308.33410 566.54102 502.60975 280.32142 424.17610 ## Jul Aug Sep Oct Nov Dec ## 2011 157.64630 287.24653 176.19523 315.65341 292.57807 170.13069 ## 2012 142.89984 288.58842 80.49051 5571.15653 3457.27812 3253.57336 ## 2013 379.41362 322.99838 205.46842 779.00596 332.03457 248.89939 ## 2014 454.45573 219.11177 157.53593 836.57498 376.45107 317.53476 ## 2015 257.65850 227.20326 123.34945 883.11220 498.41373 242.45180 ## 2016 432.31664 301.61184 225.04199 1120.37553 452.83734 347.32016 ## 2017 365.36280 275.68807 175.99260 1279.35872 366.57150 278.86587 ## 2018 344.08223 243.18631 150.59965 1293.88334 565.87121 397.27368 ## 2019 467.20195 436.23339 466.53727 1641.95487 692.74998 297.06861 ## 2020 273.60601 438.09977 170.52803 762.78539 487.91516 368.91965 ## 2021
Acehoutflowts <- ts(dataoutflowperbulan$`Aceh`, frequency = 12, start = c(2011,1)) Acehoutflowts
## Jan Feb Mar Apr May Jun ## 2011 349.57673 192.62487 230.35748 528.59007 523.47023 405.84701 ## 2012 420.97459 217.70857 503.88607 600.25342 429.26734 606.25526 ## 2013 758.75245 1850.82994 2442.65886 1618.83372 2777.13063 2209.74012 ## 2014 288.10448 489.92887 504.83732 773.93194 485.84142 912.38357 ## 2015 269.29171 255.71308 521.69449 1125.85624 564.44034 1011.07770 ## 2016 307.32375 172.45727 730.75026 667.74179 1079.70825 2642.66616 ## 2017 247.27680 344.01370 677.88709 850.88747 1157.54011 2346.78323 ## 2018 120.03917 266.02669 996.17473 707.23188 1634.43230 1889.68997 ## 2019 85.36298 400.92165 964.22663 1218.54729 3312.30047 122.91218 ## 2020 182.38950 426.10026 1433.83382 1432.33902 1689.68700 436.00470 ## 2021 56.98918 60.56520 591.41875 1789.00566 2112.99646 176.09492 ## Jul Aug Sep Oct Nov Dec ## 2011 957.58488 1046.09243 123.98156 634.45751 595.14381 750.32697 ## 2012 600.85083 791.04331 303.81795 854.83456 207.40890 841.70726 ## 2013 5383.25551 2570.21842 566.69494 895.80335 699.91951 1504.22825 ## 2014 1538.16507 285.80192 611.06198 902.31059 586.60778 1250.89508 ## 2015 1558.53777 301.57675 1040.79937 316.39942 824.14892 1847.02405 ## 2016 692.69059 653.34617 1027.41562 515.70143 962.49370 1858.31057 ## 2017 282.09425 1520.49864 354.31840 667.42332 766.85433 2544.67010 ## 2018 278.98765 1155.80705 609.61619 549.33587 622.53291 2619.93560 ## 2019 687.35821 1230.78590 600.44006 552.87679 1055.67352 2855.56524 ## 2020 1768.67777 455.94178 829.58521 1174.85940 774.36491 2269.89617 ## 2021 662.04381 320.71844
plot.ts(Acehinflowts, col = 'blue')
lines(Acehoutflowts, col = 'red')
legend('right', c('Inflow','Outflow'),fill = c('grey','red'))
Acehintscomponents <- decompose(Acehinflowts)
Acehintscomponents$seasonal
## Jan Feb Mar Apr May Jun
## 2011 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2012 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2013 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2014 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2015 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2016 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2017 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2018 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2019 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2020 -95.49778 -62.42673 200.12086 240.50931 694.72915 -370.43198
## 2021 -95.49778 -62.42673 200.12086 240.50931 694.72915
## Jul Aug Sep Oct Nov Dec
## 2011 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2012 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2013 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2014 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2015 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2016 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2017 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2018 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2019 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2020 -369.35764 -395.44997 -509.58543 743.44204 45.60340 -121.65522
## 2021
Acehouttscomponents <- decompose(Acehoutflowts)
Acehouttscomponents$seasonal
## Jan Feb Mar Apr May Jun
## 2011 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2012 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2013 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2014 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2015 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2016 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2017 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2018 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2019 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2020 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## 2021 -708.278397 -529.248520 -10.306620 8.333003 464.415314 350.679991
## Jul Aug Sep Oct Nov Dec
## 2011 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2012 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2013 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2014 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2015 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2016 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2017 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2018 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2019 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2020 414.184121 42.244469 -353.047814 -260.176871 -268.937025 850.138349
## 2021 414.184121 42.244469
plot(Acehintscomponents$seasonal, type = 'l', col = 'turquoise') lines(Acehouttscomponents$seasonal, col = "orange") legend("right",c("Inflow","Outflow"),fill=c("turquoise","red"))
plot(Acehintscomponents$trend, type = 'l', col = 'red') lines(Acehouttscomponents$trend, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("red","green"))
plot(Acehintscomponents$random, type = 'l', col = 'Skyblue') lines(Acehouttscomponents$random, col = 'purple') legend('right', c("Inflow","Outflow"),fill=c("skyblue","purple"))
plot(Acehintscomponents$figure, type = 'l', col = 'blue') lines(Acehouttscomponents$figure, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("blue","green"))
Acehintsseasonallyadjusted <- Acehtimeseries - Acehintscomponents$seasonal plot(Acehintsseasonallyadjusted)
plot(datainflowtahun$Tahun, datainflowtahun$`Sumatera Utara`, type = "l", col = "blue", main = 'Data Inflow Uang Kartal di Sumatra Utara Setiap Tahun', xlab = 'Tahun Periode', ylab = 'Data Inflow-Outflow') lines(dataoutflowtahun$Tahun, dataoutflowtahun$`Sumatera Utara`, col = 'green') legend('top', c("Inflow","Outlow"),fill=c("blue","green"))
plot(datainflowperbulan$Bulan, datainflowperbulan$`Sumatera Utara`, type = "l", col = "steelblue", main = 'Data Inflow-Outflow Uang Kartal di Sumatera Utara Setiap Bulan', xlab = 'Bulan', ylab = 'Data Inflow-Outflow') lines(dataoutflowperbulan$Bulan, dataoutflowperbulan$`Sumatera Utara`, col = 'purple') legend('right',c('Inflow','Outflow'),fill = c('steelblue','yellow'))
Sumutts <- datainflowperbulan$`Sumatera Utara` plot.ts(Sumutts, type = "l", col = "yellow")
logsumut <- dataoutflowperbulan$`Sumatera Utara` plot.ts(logsumut, type = "l", col = "steelblue")
library(TTR) sumutSMA3 <- SMA(datainflowperbulan$`Sumatera Utara`, n = 3) plot.ts(sumutSMA3)
library('TTR') sumutSMA3 <- SMA(datainflowperbulan$`Sumatera Utara`, n = 8) plot.ts(sumutSMA3)
sumutinflowts <- ts(datainflowperbulan$`Sumatera Utara`, frequency = 12, start = c(2011,1))
sumutinflowts
## Jan Feb Mar Apr May Jun Jul
## 2011 1429.1551 1539.2862 1636.5456 1791.1685 1255.7771 4171.7420 1940.8248
## 2012 1958.6650 2340.7850 1763.7063 2418.6288 3146.4553 2265.7190 1794.1134
## 2013 1005.6172 965.7285 915.6734 1064.5788 2923.1453 1883.2831 2061.2406
## 2014 2412.9589 2104.0928 2277.4757 1289.7373 6180.5783 2309.9967 2132.9841
## 2015 2118.8912 2064.3412 2195.4568 4316.3041 3070.8514 2205.2647 2172.2108
## 2016 2178.8535 2934.5122 1934.5506 6145.8753 2599.2919 2611.1014 2470.8154
## 2017 2445.6147 2868.9780 1696.6538 5829.4896 2961.9966 2729.2401 2687.0436
## 2018 3252.3518 2292.8486 5954.2310 4699.5902 3350.3244 3165.3554 3165.9388
## 2019 3839.8883 3018.5163 7840.8944 4193.3568 3573.5657 3295.2926 3680.2501
## 2020 2035.7135 2380.0784 4344.0487 3057.1278 2370.7092 2391.4783 1908.7555
## 2021 3669.9855 4948.0587 3752.2078 2368.1586 2461.1935
## Aug Sep Oct Nov Dec
## 2011 1942.8641 1608.2825 2979.0495 2137.5356 2034.3183
## 2012 1956.5636 1185.1042 2011.8480 1284.0139 986.4736
## 2013 1888.7141 1129.7521 3915.7218 2518.0923 1977.0690
## 2014 1911.6489 1472.3948 4313.0187 1833.3080 2167.4386
## 2015 2272.4471 1524.0474 4181.4312 2940.6137 2494.2178
## 2016 2171.7520 1763.8555 4297.6567 2983.0020 2741.7477
## 2017 2706.0655 1669.2277 5434.8880 2756.8291 2766.0818
## 2018 3130.5635 1799.6573 5704.4344 3720.4500 3145.5627
## 2019 3329.0633 1771.0466 6476.7265 3659.4621 2723.3467
## 2020 2826.9792 2434.8872 7420.0889 3749.5795 3470.9778
## 2021
sumutoutflowts <- ts(dataoutflowperbulan$`Sumatera Utara`, frequency = 12, start = c(2011,1))
sumutoutflowts
## Jan Feb Mar Apr May Jun Jul
## 2011 940.7270 990.2344 1208.7307 1652.7141 1464.7969 2167.0247 1695.1657
## 2012 984.0324 1216.1279 1787.1988 1807.6206 1874.7360 2688.0924 1964.9303
## 2013 385.7855 571.1485 981.3722 840.9738 1249.0038 1329.4347 3110.4414
## 2014 1386.2664 1401.1061 1758.2459 2054.0262 1829.6144 1703.7050 6389.1018
## 2015 572.9684 1763.7684 1389.7572 2303.6786 1510.8211 3233.5680 5255.8327
## 2016 1101.0264 1436.2692 1955.5644 2261.7604 2799.0006 7101.1630 1545.3956
## 2017 1381.2569 1585.6275 2219.8469 2436.9895 2995.6336 6666.8397 900.1986
## 2018 464.9380 2187.8200 2554.5897 2824.5938 4441.1976 6066.3074 2069.7335
## 2019 1254.4764 2323.8685 3046.6558 4576.5874 8856.8881 780.2976 3028.1933
## 2020 1456.3547 2150.2914 3244.4160 3371.2418 4147.5741 1473.5355 3525.8830
## 2021 767.5072 1758.2828 2249.6110 5490.0438 5183.1904 2210.7195 3486.2112
## Aug Sep Oct Nov Dec
## 2011 4103.7915 824.0580 1392.1819 1597.5122 4139.5386
## 2012 3120.9933 821.0337 1242.4665 1443.9081 3543.4771
## 2013 1837.2198 1362.0435 1608.7270 1880.8227 4077.7257
## 2014 793.8406 1397.2762 1888.7593 1700.0491 4088.9477
## 2015 982.1728 1852.0552 1907.6366 2126.0199 4978.8323
## 2016 1765.1649 2518.4152 2080.3687 2207.2962 5187.3478
## 2017 2908.6280 2161.4140 2247.3297 3283.9796 6455.4113
## 2018 2934.9619 1924.2260 2159.8890 2921.3840 6358.6489
## 2019 3577.9976 2629.2801 2576.9991 3782.3821 7617.2698
## 2020 3053.7066 2141.8995 3856.8591 2151.2443 9184.5577
## 2021 2307.3456
plot.ts(sumutinflowts, col = 'blue') lines(sumutoutflowts, col = 'red') legend('right', c('Inflow','Outflow'),fill = c('blue','red'))
sumutintscomponents <- decompose(sumutinflowts) sumutintscomponents$seasonal
## Jan Feb Mar Apr May Jun ## 2011 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2012 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2013 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2014 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2015 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2016 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2017 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2018 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2019 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2020 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2021 -407.66532 -442.57366 433.15186 863.43108 520.09971 ## Jul Aug Sep Oct Nov Dec ## 2011 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2012 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2013 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2014 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2015 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2016 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2017 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2018 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2019 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2020 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2021
sumutouttscomponents <- decompose(sumutoutflowts) sumutouttscomponents$seasonal
## Jan Feb Mar Apr May Jun ## 2011 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2012 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2013 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2014 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2015 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2016 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2017 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2018 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2019 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2020 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2021 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## Jul Aug Sep Oct Nov Dec ## 2011 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2012 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2013 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2014 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2015 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2016 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2017 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2018 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2019 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2020 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2021 389.85774 -53.26060
plot(sumutintscomponents$seasonal, type = 'l', col = 'turquoise') lines(sumutouttscomponents$seasonal, col = "orange") legend("right",c("Inflow","Outflow"),fill=c("turquoise","orange"))
plot(sumutintscomponents$trend, type = 'l', col = 'red') lines(sumutouttscomponents$trend, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("red","black"))
plot(sumutintscomponents$random, type = 'l', col = 'Skyblue') lines(sumutouttscomponents$random, col = 'purple') legend('right', c("Inflow","Outflow"),fill=c("skyblue","purple"))
plot(sumutintscomponents$figure, type = 'l', col = 'blue') lines(sumutouttscomponents$figure, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("blue","green"))
sumutintsseasonallyadjusted <- Sumutts - sumutintscomponents$seasonal plot(sumutintsseasonallyadjusted)
1. visualisasi dan prediksi data Inflow-Outflow di Sumatra Barat
plot(datainflowtahun$Tahun, datainflowtahun$`Sumatera Barat`,type = "l", col = "orange", main = 'Data Inflow Uang Kartal di Sumatra Barat Setiap Tahun', xlab = 'Tahun Periode', ylab = 'Data Inflow') lines(dataoutflowtahun$Tahun, dataoutflowtahun$`Sumatera Barat`, col = 'purple') legend('top', c("Inflow","Outlow"),fill=c("orange","purple"))
plot(datainflowperbulan$Bulan, datainflowperbulan$`Sumatera Barat`, type = "l", col = "steelblue", main = 'Data Inflow-Outflow Uang Kartal di Sumatera Utara Setiap Bulan', xlab = 'Bulan', ylab = 'Data Inflow-Outflow') lines(dataoutflowperbulan$Bulan, dataoutflowperbulan$`Sumatera Barat`, col = 'purple') legend('right',c('Inflow','Outflow'),fill = c('steelblue','purple'))
Sumbarts <- datainflowperbulan$`Sumatera Barat` plot.ts(Sumbarts, type = "l", col = "yellow")
logsumbar <- dataoutflowperbulan$`Sumatera Barat` plot.ts(logsumbar, type = "l", col = "steelblue")
library(TTR) sumbarSMA3 <- SMA(datainflowperbulan$`Sumatera Barat`, n = 3) plot.ts(sumbarSMA3)
library('TTR') sumbarSMA3 <- SMA(datainflowperbulan$`Sumatera Barat`, n = 8) plot.ts(sumbarSMA3)
sumbarinflowts <- ts(datainflowperbulan$`Sumatera Barat`, frequency = 12, start = c(2011,1)) sumbarinflowts
## Jan Feb Mar Apr May Jun Jul ## 2011 539.1026 691.9377 592.4192 799.5802 586.3581 2176.2413 787.3761 ## 2012 704.9590 885.0385 641.2570 1038.4298 1339.7732 1507.8169 789.7558 ## 2013 994.6862 1107.1890 1086.4650 1303.0975 2173.6578 1202.3046 933.7316 ## 2014 993.2328 762.4694 866.8874 675.1555 3114.2115 1200.3284 1157.9625 ## 2015 836.3249 855.4427 1045.4934 2161.9387 1729.1363 824.0283 995.3346 ## 2016 737.9714 919.1321 720.4721 2928.9035 1145.6062 1048.3006 1050.2491 ## 2017 1037.7823 1173.4844 683.3602 2902.9224 1503.0438 1122.1439 1047.2614 ## 2018 1043.6172 956.1836 2214.6015 2449.9422 1185.0947 1199.5619 1008.1251 ## 2019 986.2518 810.4107 3290.2635 1379.9442 1194.5156 1066.1918 1093.7082 ## 2020 586.1949 460.8289 1752.8809 720.9419 934.1740 842.2214 604.4694 ## 2021 924.2523 2033.1787 1301.2214 934.1477 1017.1201 ## Aug Sep Oct Nov Dec ## 2011 854.4358 513.2068 1130.4905 865.3519 854.9514 ## 2012 883.7977 550.4838 1776.9203 1112.8960 940.8829 ## 2013 875.4979 548.6130 1675.2029 1111.3808 924.0093 ## 2014 931.1027 691.0219 1698.0899 904.5427 969.6610 ## 2015 750.3287 538.4899 1751.8196 892.1499 904.6083 ## 2016 1005.0248 973.9955 1850.5169 1143.2622 1287.3335 ## 2017 883.3420 677.3816 2037.4366 957.8346 732.3303 ## 2018 776.0709 497.4198 1890.0168 845.6557 917.9565 ## 2019 771.6151 503.1632 1936.5593 867.9322 593.6931 ## 2020 893.2831 502.3578 2463.1456 1078.7217 996.1128 ## 2021
sumbaroutflowts <- ts(dataoutflowperbulan$`Sumatera Barat`, frequency = 12, start = c(2011,1)) sumbaroutflowts
## Jan Feb Mar Apr May Jun ## 2011 306.70068 227.74199 347.23365 335.95990 327.77383 399.24039 ## 2012 214.52616 252.76902 462.17950 577.54488 461.72280 623.94257 ## 2013 245.10797 218.45108 398.34203 317.45463 461.02830 471.02622 ## 2014 185.88126 273.86294 480.13567 452.26115 466.95347 548.54011 ## 2015 124.28159 443.52843 443.34413 514.88579 503.17081 926.50648 ## 2016 140.03323 351.99398 316.41743 604.36993 757.45169 2598.20471 ## 2017 349.10531 710.49354 848.72339 860.68821 999.67421 3176.59985 ## 2018 55.96053 302.53616 543.51806 570.24349 1461.73993 2601.75460 ## 2019 75.55494 370.26231 613.28838 952.67623 3692.93346 50.39067 ## 2020 102.48174 308.36325 782.28278 819.13541 2242.07887 34.07573 ## 2021 86.54225 374.74081 559.24066 1554.62334 2167.68623 295.68386 ## Jul Aug Sep Oct Nov Dec ## 2011 448.56438 1376.25990 147.70279 298.57216 349.75474 734.22520 ## 2012 543.65577 1260.36359 163.22296 437.83317 405.63471 1030.89819 ## 2013 1130.65362 773.18744 411.62158 536.88884 421.89894 1125.35118 ## 2014 2100.82357 115.32964 393.25698 416.17580 555.13227 1071.69548 ## 2015 2153.22221 161.12169 337.86600 346.21304 452.70749 1063.81167 ## 2016 636.60428 298.35824 592.36023 470.20911 815.03093 1616.78339 ## 2017 151.96773 583.16929 372.26254 511.67734 738.88167 1451.21128 ## 2018 113.42245 401.53968 287.98036 398.91845 512.61803 1196.57690 ## 2019 445.31828 672.32642 403.02094 428.11685 511.72653 1249.35115 ## 2020 651.14472 565.58335 343.19704 792.57966 483.75028 1638.08473 ## 2021 684.83394 217.18849
plot.ts(sumbarinflowts, col = 'blue') lines(sumbaroutflowts, col = 'red') legend('right', c('Inflow','Outflow'),fill = c('blue','red'))
sumbarintscomponents <- decompose(sumutinflowts) sumbarintscomponents$seasonal
## Jan Feb Mar Apr May Jun ## 2011 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2012 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2013 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2014 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2015 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2016 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2017 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2018 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2019 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2020 -407.66532 -442.57366 433.15186 863.43108 520.09971 -307.36877 ## 2021 -407.66532 -442.57366 433.15186 863.43108 520.09971 ## Jul Aug Sep Oct Nov Dec ## 2011 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2012 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2013 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2014 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2015 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2016 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2017 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2018 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2019 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2020 -380.38906 -391.68067 -1192.53974 1833.90171 -88.72274 -439.64441 ## 2021
sumbarouttscomponents <- decompose(sumutoutflowts) sumbarouttscomponents$seasonal
## Jan Feb Mar Apr May Jun ## 2011 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2012 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2013 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2014 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2015 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2016 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2017 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2018 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2019 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2020 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## 2021 -1668.31245 -1004.32016 -452.48739 -76.68515 712.34043 835.13962 ## Jul Aug Sep Oct Nov Dec ## 2011 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2012 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2013 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2014 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2015 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2016 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2017 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2018 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2019 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2020 389.85774 -53.26060 -805.47535 -492.84969 -310.99376 2927.04677 ## 2021 389.85774 -53.26060
plot(sumbarintscomponents$seasonal, type = 'l', col = 'turquoise') lines(sumbarouttscomponents$seasonal, col = "orange") legend("right",c("Inflow","Outflow"),fill=c("turquoise","orange"))
plot(sumbarintscomponents$seasonal, type = 'l', col = 'turquoise') lines(sumbarouttscomponents$seasonal, col = "orange") legend("right",c("Inflow","Outflow"),fill=c("turquoise","orange"))
plot(sumbarintscomponents$random, type = 'l', col = 'Skyblue') lines(sumbarouttscomponents$random, col = 'purple') legend('right', c("Inflow","Outflow"),fill=c("skyblue","purple"))
plot(sumbarintscomponents$figure, type = 'l', col = 'blue') lines(sumbarouttscomponents$figure, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("blue","green"))
sumbarintsseasonallyadjusted <- Sumbarts - sumbarintscomponents$seasonal plot(sumbarintsseasonallyadjusted)
plot(dataoutflowtahun$Tahun, dataoutflowtahun$`Sumatera`, type = "l", col = "blue", main = 'Data Inflow dan Outflow Uang Kartal di Sumatera Setiap Tahun', xlab = 'Tahun Periode', ylab = 'Data Inflow dan Outflow')
lines(datainflowtahun$Tahun, datainflowtahun$`Sumatera`, col = 'red')
legend('top', c("Outlow","Inflow"),fill=c("blue","red"))
plot(datainflowperbulan$Bulan, datainflowperbulan$`Sumatera`, type = "l", col = "steelblue", main = 'Data Inflow-Outflow Uang Kartal di Sumatera Setiap Bulan', xlab = 'Bulan', ylab = 'Data Inflow-Outflow')
lines(dataoutflowperbulan$Bulan, dataoutflowperbulan$`Sumatera`, col = 'purple')
legend('right',c('Inflow','Outflow'),fill = c('steelblue','purple'))
Sumaterats <- datainflowperbulan$`Sumatera`
plot.ts(Sumaterats, type = "l", col = "yellow")
logsumatera <- dataoutflowperbulan$`Sumatera`
plot.ts(logsumatera, type = "l", col = "orange")
library(TTR) sumateraSMA3 <- SMA(datainflowperbulan$`Sumatera`, n = 3) plot.ts(sumateraSMA3)
library('TTR') sumateraSMA3 <- SMA(datainflowperbulan$`Sumatera`, n = 8) plot.ts(sumateraSMA3)
sumaterainflowts <- ts(datainflowperbulan$`Sumatera`, frequency = 12, start = c(2011,1)) sumaterainflowts
## Jan Feb Mar Apr May Jun Jul ## 2011 3156.548 3821.275 3686.394 4369.643 3668.498 12874.594 4776.883 ## 2012 4102.575 5321.981 4064.952 5489.699 9422.659 6813.338 4563.922 ## 2013 8267.947 7623.367 6961.815 7552.290 19523.108 5265.619 6181.279 ## 2014 5988.730 4921.418 5591.202 3440.204 19746.407 6305.927 6798.485 ## 2015 4954.255 5358.552 5936.657 15050.224 8915.131 5710.106 6763.497 ## 2016 5254.795 6761.434 5066.314 20548.504 6548.412 7498.570 6952.295 ## 2017 6638.224 7317.874 4071.240 21208.720 8722.990 8250.898 7610.729 ## 2018 7628.992 5973.344 19402.076 14326.890 9119.047 8886.660 8429.308 ## 2019 9406.456 7523.072 26667.739 11014.410 10707.883 9462.332 10195.256 ## 2020 6536.998 7788.132 14946.781 8278.451 8012.437 7559.106 5735.149 ## 2021 9095.626 16275.454 10211.629 6787.420 7085.136 ## Aug Sep Oct Nov Dec ## 2011 5669.993 3496.335 7371.435 5443.242 5022.248 ## 2012 5452.494 2842.029 13436.780 8035.017 7017.142 ## 2013 5347.888 3157.046 11612.677 6964.701 5238.644 ## 2014 5515.775 3899.380 12838.000 5173.687 5600.472 ## 2015 6087.162 4161.556 13692.690 7760.507 6313.597 ## 2016 6098.330 5268.100 12734.711 7752.686 7568.883 ## 2017 7122.755 4748.106 16240.858 7668.179 7130.231 ## 2018 8078.990 4610.368 17413.907 9281.546 8215.984 ## 2019 8492.726 5380.872 19330.620 10365.349 7128.873 ## 2020 8462.623 5200.062 21182.291 9983.745 8648.731 ## 2021
sumateraoutflowts <- ts(dataoutflowperbulan$`Sumatera`, frequency = 12, start = c(2011,1)) sumateraoutflowts
## Jan Feb Mar Apr May Jun Jul ## 2011 3441.614 3989.113 4228.628 6721.276 5787.181 7394.536 7154.223 ## 2012 3200.178 4100.054 6605.179 6665.551 7147.179 8560.319 7711.993 ## 2013 2221.436 4621.158 8219.574 4613.748 8423.251 7790.216 17485.108 ## 2014 4289.908 4820.657 7088.166 8015.452 7757.313 8157.185 24722.650 ## 2015 2036.392 5682.352 6300.508 10051.597 7592.788 12421.852 22934.645 ## 2016 2804.053 4909.740 6985.628 8649.278 10859.812 28813.953 6455.632 ## 2017 4855.706 6495.905 9234.822 9234.883 11638.176 29889.710 3252.637 ## 2018 2424.451 7487.879 10455.312 9952.146 19165.027 25439.136 6324.910 ## 2019 3735.569 7719.811 11089.472 15127.060 37664.505 2465.417 10575.813 ## 2020 4693.754 6958.705 12667.832 11775.906 19644.928 3971.849 12710.177 ## 2021 1990.678 6099.024 9638.351 19930.265 22004.413 7748.386 11650.666 ## Aug Sep Oct Nov Dec ## 2011 16042.967 1914.778 5173.616 5609.913 12634.335 ## 2012 13610.489 3180.756 6273.015 5018.851 13161.070 ## 2013 10207.967 6806.163 8014.259 8355.285 16529.555 ## 2014 2377.454 6171.922 7655.389 7005.319 14276.798 ## 2015 4668.410 6733.060 5783.016 8056.207 16924.980 ## 2016 7937.744 10071.108 7571.519 9563.416 17369.845 ## 2017 11015.435 6693.301 8559.331 12083.466 20652.339 ## 2018 10042.081 7060.453 8155.825 9944.104 19225.025 ## 2019 11780.050 8535.685 8868.257 12462.606 23460.023 ## 2020 9744.450 9247.241 14431.727 9435.013 25307.224 ## 2021 7565.509
plot.ts(sumaterainflowts, col = 'blue')
lines(sumateraoutflowts, col = 'red')
legend('right', c('Inflow','Outflow'),fill = c('black','red'))
sumateraintscomponents <- decompose(sumaterainflowts) sumateraintscomponents$seasonal
## Jan Feb Mar Apr May Jun ## 2011 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2012 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2013 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2014 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2015 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2016 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2017 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2018 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2019 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2020 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 -1213.0639 ## 2021 -1755.1280 -1793.5819 1976.6683 3482.6880 2709.8038 ## Jul Aug Sep Oct Nov Dec ## 2011 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2012 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2013 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2014 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2015 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2016 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2017 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2018 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2019 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2020 -1435.0086 -1679.4540 -4115.0231 6156.7258 -610.1152 -1724.5112 ## 2021
sumateraouttscomponents <- decompose(sumateraoutflowts) sumateraouttscomponents$seasonal
## Jan Feb Mar Apr May ## 2011 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2012 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2013 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2014 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2015 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2016 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2017 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2018 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2019 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2020 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## 2021 -6834.998330 -4154.095027 -1069.366771 -541.827422 4487.308681 ## Jun Jul Aug Sep Oct ## 2011 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2012 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2013 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2014 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2015 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2016 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2017 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2018 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2019 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2020 4146.113221 2196.088359 3.268476 -3129.321269 -1799.750549 ## 2021 4146.113221 2196.088359 3.268476 ## Nov Dec ## 2011 -1217.537318 7914.117948 ## 2012 -1217.537318 7914.117948 ## 2013 -1217.537318 7914.117948 ## 2014 -1217.537318 7914.117948 ## 2015 -1217.537318 7914.117948 ## 2016 -1217.537318 7914.117948 ## 2017 -1217.537318 7914.117948 ## 2018 -1217.537318 7914.117948 ## 2019 -1217.537318 7914.117948 ## 2020 -1217.537318 7914.117948 ## 2021
plot(sumateraintscomponents$seasonal, type = 'l', col = 'turquoise') lines(sumateraouttscomponents$seasonal, col = "orange") legend("right",c("Inflow","Outflow"),fill=c("turquoise","orange"))
plot(sumateraintscomponents$trend, type = 'l', col = 'red') lines(sumateraouttscomponents$trend, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("red","green"))
plot(sumateraintscomponents$random, type = 'l', col = 'Skyblue') lines(sumateraouttscomponents$random, col = 'purple') legend('right', c("Inflow","Outflow"),fill=c("skyblue","purple"))
plot(sumateraintscomponents$figure, type = 'l', col = 'blue') lines(sumateraouttscomponents$figure, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("blue","green"))
sumateraintsseasonallyadjusted <- Sumaterats - sumateraintscomponents$seasonal plot(sumateraintsseasonallyadjusted)
sumaterasforecast <- HoltWinters(Sumaterats, beta=FALSE, gamma=FALSE)
sumaterasforecast
## Holt-Winters exponential smoothing without trend and without seasonal component.
##
## Call:
## HoltWinters(x = Sumaterats, beta = FALSE, gamma = FALSE)
##
## Smoothing parameters:
## alpha: 0.07627218
## beta : FALSE
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 9833.919
sumaterasforecast$fitted
## Time Series:
## Start = 2
## End = 125
## Frequency = 1
## xhat level
## 2 3156.548 3156.548
## 3 3207.249 3207.249
## 4 3243.794 3243.794
## 5 3329.665 3329.665
## 6 3355.508 3355.508
## 7 4081.550 4081.550
## 8 4134.584 4134.584
## 9 4251.693 4251.693
## 10 4194.081 4194.081
## 11 4436.424 4436.424
## 12 4513.216 4513.216
## 13 4552.041 4552.041
## 14 4517.760 4517.760
## 15 4579.099 4579.099
## 16 4539.884 4539.884
## 17 4612.329 4612.329
## 18 4979.223 4979.223
## 19 5119.115 5119.115
## 20 5076.769 5076.769
## 21 5105.427 5105.427
## 22 4932.792 4932.792
## 23 5581.410 5581.410
## 24 5768.552 5768.552
## 25 5863.785 5863.785
## 26 6047.155 6047.155
## 27 6167.376 6167.376
## 28 6227.970 6227.970
## 29 6328.979 6328.979
## 30 7335.324 7335.324
## 31 7177.463 7177.463
## 32 7101.482 7101.482
## 33 6967.731 6967.731
## 34 6677.082 6677.082
## 35 7053.531 7053.531
## 36 7046.755 7046.755
## 37 6908.847 6908.847
## 38 6838.667 6838.667
## 39 6692.435 6692.435
## 40 6608.441 6608.441
## 41 6366.793 6366.793
## 42 7387.285 7387.285
## 43 7304.808 7304.808
## 44 7266.189 7266.189
## 45 7132.681 7132.681
## 46 6886.070 6886.070
## 47 7340.037 7340.037
## 48 7174.805 7174.805
## 49 7054.727 7054.727
## 50 6894.519 6894.519
## 51 6777.368 6777.368
## 52 6713.245 6713.245
## 53 7349.124 7349.124
## 54 7468.567 7468.567
## 55 7334.446 7334.446
## 56 7290.898 7290.898
## 57 7199.087 7199.087
## 58 6967.407 6967.407
## 59 7480.359 7480.359
## 60 7501.727 7501.727
## 61 7411.106 7411.106
## 62 7246.639 7246.639
## 63 7209.631 7209.631
## 64 7046.156 7046.156
## 65 8076.009 8076.009
## 66 7959.496 7959.496
## 67 7924.340 7924.340
## 68 7850.200 7850.200
## 69 7716.581 7716.581
## 70 7529.830 7529.830
## 71 7926.818 7926.818
## 72 7913.537 7913.537
## 73 7887.249 7887.249
## 74 7791.983 7791.983
## 75 7755.822 7755.822
## 76 7474.791 7474.791
## 77 8522.307 8522.307
## 78 8537.614 8537.614
## 79 8515.746 8515.746
## 80 8446.718 8446.718
## 81 8345.736 8345.736
## 82 8071.337 8071.337
## 83 8694.444 8694.444
## 84 8616.169 8616.169
## 85 8502.833 8502.833
## 86 8436.183 8436.183
## 87 8248.337 8248.337
## 88 9099.057 9099.057
## 89 9497.795 9497.795
## 90 9468.907 9468.907
## 91 9424.498 9424.498
## 92 9348.593 9348.593
## 93 9251.757 9251.757
## 94 8897.749 8897.749
## 95 9547.295 9547.295
## 96 9527.025 9527.025
## 97 9427.029 9427.029
## 98 9425.460 9425.460
## 99 9280.361 9280.361
## 100 10606.534 10606.534
## 101 10637.644 10637.644
## 102 10643.001 10643.001
## 103 10552.949 10552.949
## 104 10525.667 10525.667
## 105 10370.610 10370.610
## 106 9990.032 9990.032
## 107 10702.459 10702.459
## 108 10676.747 10676.747
## 109 10406.143 10406.143
## 110 10111.035 10111.035
## 111 9933.862 9933.862
## 112 10316.208 10316.208
## 113 10160.784 10160.784
## 114 9996.925 9996.925
## 115 9810.987 9810.987
## 116 9500.114 9500.114
## 117 9420.982 9420.982
## 118 9099.043 9099.043
## 119 10020.659 10020.659
## 120 10017.844 10017.844
## 121 9913.418 9913.418
## 122 9851.044 9851.044
## 123 10341.047 10341.047
## 124 10331.176 10331.176
## 125 10060.886 10060.886
plot(sumaterasforecast)
sumaterasforecast$SSE
## [1] 2371546657
sumaterasforecast <- HoltWinters(sumateraintscomponents$seasonal, beta = FALSE, gamma = FALSE)
sumaterasforecast
## Holt-Winters exponential smoothing without trend and without seasonal component.
##
## Call:
## HoltWinters(x = sumateraintscomponents$seasonal, beta = FALSE, gamma = FALSE)
##
## Smoothing parameters:
## alpha: 0.04038928
## beta : FALSE
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 165.2801
sumaterasforecast$fitted
## xhat level
## Feb 2011 -1755.127976 -1755.127976
## Mar 2011 -1756.681102 -1756.681102
## Apr 2011 -1605.893818 -1605.893818
## May 2011 -1400.369680 -1400.369680
## Jun 2011 -1234.362745 -1234.362745
## Jul 2011 -1233.502501 -1233.502501
## Aug 2011 -1241.641188 -1241.641188
## Sep 2011 -1259.324130 -1259.324130
## Oct 2011 -1374.663747 -1374.663747
## Nov 2011 -1070.476371 -1070.476371
## Dec 2011 -1051.882719 -1051.882719
## Jan 2012 -1079.049697 -1079.049697
## Feb 2012 -1106.356009 -1106.356009
## Mar 2012 -1134.112565 -1134.112565
## Apr 2012 -1008.470375 -1008.470375
## May 2012 -827.075737 -827.075737
## Jun 2012 -684.223729 -684.223729
## Jul 2012 -705.583202 -705.583202
## Aug 2012 -735.044168 -735.044168
## Sep 2012 -773.188197 -773.188197
## Oct 2012 -908.162493 -908.162493
## Nov 2012 -622.816765 -622.816765
## Dec 2012 -622.303760 -622.303760
## Jan 2013 -666.821122 -666.821122
## Feb 2013 -710.777048 -710.777048
## Mar 2013 -754.510752 -754.510752
## Apr 2013 -644.200404 -644.200404
## May 2013 -477.518367 -477.518367
## Jun 2013 -348.784729 -348.784729
## Jul 2013 -383.692340 -383.692340
## Aug 2013 -426.154245 -426.154245
## Sep 2013 -476.774115 -476.774115
## Oct 2013 -623.720361 -623.720361
## Nov 2013 -349.863045 -349.863045
## Dec 2013 -360.374443 -360.374443
## Jan 2014 -415.470940 -415.470940
## Feb 2014 -469.578719 -469.578719
## Mar 2014 -523.054249 -523.054249
## Apr 2014 -422.092262 -422.092262
## May 2014 -264.381011 -264.381011
## Jun 2014 -144.255837 -144.255837
## Jul 2014 -187.424222 -187.424222
## Aug 2014 -237.813254 -237.813254
## Sep 2014 -296.040081 -296.040081
## Oct 2014 -450.286044 -450.286044
## Nov 2014 -183.433614 -183.433614
## Dec 2014 -200.666977 -200.666977
## Jan 2015 -262.213943 -262.213943
## Feb 2015 -322.511661 -322.511661
## Mar 2015 -381.927123 -381.927123
## Apr 2015 -286.665158 -286.665158
## May 2015 -134.423711 -134.423711
## Jun 2015 -19.547418 -19.547418
## Jul 2015 -67.752686 -67.752686
## Aug 2015 -122.975164 -122.975164
## Sep 2015 -185.840218 -185.840218
## Oct 2015 -344.537074 -344.537074
## Nov 2015 -81.955769 -81.955769
## Dec 2015 -103.287748 -103.287748
## Jan 2016 -168.767791 -168.767791
## Feb 2016 -232.839731 -232.839731
## Mar 2016 -295.876978 -295.876978
## Apr 2016 -204.090516 -204.090516
## May 2016 -55.184199 -55.184199
## Jun 2016 56.491668 56.491668
## Jul 2016 5.215236 5.215236
## Aug 2016 -52.954364 -52.954364
## Sep 2016 -118.647508 -118.647508
## Oct 2016 -280.058228 -280.058228
## Nov 2016 -20.081177 -20.081177
## Dec 2016 -43.912227 -43.912227
## Jan 2017 -111.790404 -111.790404
## Feb 2017 -178.163620 -178.163620
## Mar 2017 -243.409194 -243.409194
## Apr 2017 -153.741869 -153.741869
## May 2017 -6.869097 -6.869097
## Jun 2017 102.855358 102.855358
## Jul 2017 49.706330 49.706330
## Aug 2017 -10.260233 -10.260233
## Sep 2017 -77.677762 -77.677762
## Oct 2017 -240.743221 -240.743221
## Nov 2017 17.645925 17.645925
## Dec 2017 -7.708894 -7.708894
## Jan 2018 -77.049298 -77.049298
## Feb 2018 -144.825682 -144.825682
## Mar 2018 -211.417752 -211.417752
## Apr 2018 -123.042537 -123.042537
## May 2018 22.590311 22.590311
## Jun 2018 131.124921 131.124921
## Jul 2018 76.834106 76.834106
## Aug 2018 15.771872 15.771872
## Sep 2018 -52.697074 -52.697074
## Oct 2018 -216.771486 -216.771486
## Nov 2018 40.649460 40.649460
## Dec 2018 14.365544 14.365544
## Jan 2019 -55.866430 -55.866430
## Feb 2019 -124.498375 -124.498375
## Mar 2019 -191.911450 -191.911450
## Apr 2019 -104.324081 -104.324081
## May 2019 40.552742 40.552742
## Jun 2019 148.361863 148.361863
## Jul 2019 93.374861 93.374861
## Aug 2019 31.644557 31.644557
## Sep 2019 -37.465476 -37.465476
## Oct 2019 -202.155080 -202.155080
## Nov 2019 54.675519 54.675519
## Dec 2019 27.825101 27.825101
## Jan 2020 -42.950495 -42.950495
## Feb 2020 -112.104105 -112.104105
## Mar 2020 -180.017776 -180.017776
## Apr 2020 -92.910783 -92.910783
## May 2020 51.505065 51.505065
## Jun 2020 158.871829 158.871829
## Jul 2020 103.460337 103.460337
## Aug 2020 41.322688 41.322688
## Sep 2020 -28.178237 -28.178237
## Oct 2020 -193.242946 -193.242946
## Nov 2020 63.227698 63.227698
## Dec 2020 36.031864 36.031864
## Jan 2021 -35.075197 -35.075197
## Feb 2021 -104.546885 -104.546885
## Mar 2021 -172.765786 -172.765786
## Apr 2021 -85.951697 -85.951697
## May 2021 58.183079 58.183079
plot(sumaterasforecast)
sumaterasforecast$SSE
## [1] 1050129697
library(forecast)
dftimeseries.hw <- HoltWinters(Sumaterats, gamma = FALSE) sumateratsforecasts2 <- forecast(dftimeseries.hw, h = 20) sumateratsforecasts2
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 ## 126 8610.430 2865.0876 14355.77 -176.3132 17397.17 ## 127 8521.318 2761.9865 14280.65 -286.8193 17329.45 ## 128 8432.205 2650.6877 14213.72 -409.8629 17274.27 ## 129 8343.093 2529.3936 14156.79 -548.1928 17234.38 ## 130 8253.980 2396.3922 14111.57 -704.4276 17212.39 ## 131 8164.868 2250.0852 14079.65 -881.0115 17210.75 ## 132 8075.755 2089.0174 14062.49 -1080.1700 17231.68 ## 133 7986.643 1911.9038 14061.38 -1303.8687 17277.15 ## 134 7897.530 1717.6506 14077.41 -1553.7799 17348.84 ## 135 7808.417 1505.3716 14111.46 -1831.2593 17448.09 ## 136 7719.305 1274.3944 14164.22 -2137.3351 17575.94 ## 137 7630.192 1024.2596 14236.13 -2472.7100 17733.09 ## 138 7541.080 754.7108 14327.45 -2837.7760 17919.94 ## 139 7451.967 465.6788 14438.26 -3232.6389 18136.57 ## 140 7362.855 157.2596 14568.45 -3657.1519 18382.86 ## 141 7273.742 -170.3100 14717.79 -4110.9531 18658.44 ## 142 7184.630 -516.6786 14885.94 -4593.5049 18962.76 ## 143 7095.517 -881.4056 15072.44 -5104.1334 19295.17 ## 144 7006.404 -1263.9848 15276.79 -5642.0645 19654.87 ## 145 6917.292 -1663.8658 15498.45 -6206.4562 20041.04
plot(sumateratsforecasts2)
sumateratsdiff1 <- diff(Sumaterats, differences = 1) plot.ts(sumateratsdiff1)
acf(sumateratsdiff1, lag.max = 20)