Data Inflow-OutFlow Pertahun untuk Daerah Sumatra dan Sekitarnya |
library(readxl)
## Warning: package 'readxl' was built under R version 4.1.2
datainflow <- read_excel(path = "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 = "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>
Data Inflow-Outflow Perbulan untuk Daerah Sumatra dan Sekitarnya |
library(readxl) datainflowperbulan <- read_excel(path = 'Inflow perbulan.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 = 'Outflow perbulan.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>
berikut adalah visualisasi dan prediksi data Inflow-Outflow di Aceh :
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 = 'purple' ) 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 = "yellow")
logAceh <- dataoutflowperbulan$`Aceh` plot.ts(logAceh, type = "l", col = "steelblue")
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 124.33329 115.14321 154.41614 122.18349 122.75253 151.37534 ## 2012 315.65341 292.57807 170.13069 139.33374 167.56600 119.32971 ## 2013 5571.15653 3457.27812 3253.57336 3775.08977 3705.38033 3449.77565 ## 2014 779.00596 332.03457 248.89939 260.82180 168.17801 194.97802 ## 2015 836.57498 376.45107 317.53476 263.06848 256.64615 398.59527 ## 2016 883.11220 498.41373 242.45180 218.98473 298.46423 450.32018 ## 2017 1120.37553 452.83734 347.32016 240.71874 299.60563 194.84441 ## 2018 1279.35872 366.57150 278.86587 262.95066 288.49282 1005.08498 ## 2019 1293.88334 565.87121 397.27368 342.84300 420.44274 1554.92585 ## 2020 1641.95487 692.74998 297.06861 281.42142 489.21304 1095.11262 ## 2021 762.78539 487.91516 368.91965 308.33410 566.54102 502.60975 ## Jul Aug Sep Oct Nov Dec ## 2011 107.22432 183.84525 605.62334 157.64630 287.24653 176.19523 ## 2012 196.61835 420.06418 286.31394 142.89984 288.58842 80.49051 ## 2013 3456.32173 8516.17096 243.91990 379.41362 322.99838 205.46842 ## 2014 173.99322 1306.11875 271.45458 454.45573 219.11177 157.53593 ## 2015 977.94399 495.56495 179.23767 257.65850 227.20326 123.34945 ## 2016 1374.47417 310.75050 538.99459 432.31664 301.61184 225.04199 ## 2017 1149.75614 264.01934 627.70230 365.36280 275.68807 175.99260 ## 2018 784.64208 369.23511 426.04458 344.08223 243.18631 150.59965 ## 2019 473.28934 684.81679 405.51614 467.20195 436.23339 466.53727 ## 2020 257.81810 592.86464 410.39330 273.60601 438.09977 170.52803 ## 2021 280.32142 424.17610
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('blue','red'))
Acehintscomponents <- decompose(Acehinflowts) Acehintscomponents$seasonal
## Jan Feb Mar Apr May Jun ## 2011 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2012 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2013 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2014 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2015 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2016 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2017 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2018 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2019 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2020 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## 2021 746.11568 48.27704 -118.98158 -92.82414 -59.75309 202.79450 ## Jul Aug Sep Oct Nov Dec ## 2011 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2012 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2013 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2014 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2015 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2016 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2017 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2018 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2019 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2020 209.38959 624.31306 -292.95893 -366.68400 -392.77633 -506.91179 ## 2021 209.38959 624.31306
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","orange"))
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)
berikut adalah visualisasi dan prediksi data Inflow-Outflow di Sumatera Utara :
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','purple'))
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 2068.3243 1826.2643 2027.5207 1429.1551 1539.2862 1636.5456 1791.1685 ## 2012 2979.0495 2137.5356 2034.3183 1958.6650 2340.7850 1763.7063 2418.6288 ## 2013 2011.8480 1284.0139 986.4736 1005.6172 965.7285 915.6734 1064.5788 ## 2014 3915.7218 2518.0923 1977.0690 2412.9589 2104.0928 2277.4757 1289.7373 ## 2015 4313.0187 1833.3080 2167.4386 2118.8912 2064.3412 2195.4568 4316.3041 ## 2016 4181.4312 2940.6137 2494.2178 2178.8535 2934.5122 1934.5506 6145.8753 ## 2017 4297.6567 2983.0020 2741.7477 2445.6147 2868.9780 1696.6538 5829.4896 ## 2018 5434.8880 2756.8291 2766.0818 3252.3518 2292.8486 5954.2310 4699.5902 ## 2019 5704.4344 3720.4500 3145.5627 3839.8883 3018.5163 7840.8944 4193.3568 ## 2020 6476.7265 3659.4621 2723.3467 2035.7135 2380.0784 4344.0487 3057.1278 ## 2021 7420.0889 3749.5795 3470.9778 3669.9855 4948.0587 3752.2078 2368.1586 ## Aug Sep Oct Nov Dec ## 2011 1255.7771 4171.7420 1940.8248 1942.8641 1608.2825 ## 2012 3146.4553 2265.7190 1794.1134 1956.5636 1185.1042 ## 2013 2923.1453 1883.2831 2061.2406 1888.7141 1129.7521 ## 2014 6180.5783 2309.9967 2132.9841 1911.6489 1472.3948 ## 2015 3070.8514 2205.2647 2172.2108 2272.4471 1524.0474 ## 2016 2599.2919 2611.1014 2470.8154 2171.7520 1763.8555 ## 2017 2961.9966 2729.2401 2687.0436 2706.0655 1669.2277 ## 2018 3350.3244 3165.3554 3165.9388 3130.5635 1799.6573 ## 2019 3573.5657 3295.2926 3680.2501 3329.0633 1771.0466 ## 2020 2370.7092 2391.4783 1908.7555 2826.9792 2434.8872 ## 2021 2461.1935
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 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2012 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2013 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2014 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2015 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2016 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2017 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2018 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2019 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2020 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2021 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## Jul Aug Sep Oct Nov Dec ## 2011 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2012 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2013 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2014 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2015 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2016 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2017 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2018 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2019 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2020 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2021 757.67593 390.04691
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","green"))
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)
berikut adalah visualisasi dan prediksi data Inflow-Outflow di Sumatera 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 544.5248 450.0701 849.2939 539.1026 691.9377 592.4192 799.5802 ## 2012 1130.4905 865.3519 854.9514 704.9590 885.0385 641.2570 1038.4298 ## 2013 1776.9203 1112.8960 940.8829 994.6862 1107.1890 1086.4650 1303.0975 ## 2014 1675.2029 1111.3808 924.0093 993.2328 762.4694 866.8874 675.1555 ## 2015 1698.0899 904.5427 969.6610 836.3249 855.4427 1045.4934 2161.9387 ## 2016 1751.8196 892.1499 904.6083 737.9714 919.1321 720.4721 2928.9035 ## 2017 1850.5169 1143.2622 1287.3335 1037.7823 1173.4844 683.3602 2902.9224 ## 2018 2037.4366 957.8346 732.3303 1043.6172 956.1836 2214.6015 2449.9422 ## 2019 1890.0168 845.6557 917.9565 986.2518 810.4107 3290.2635 1379.9442 ## 2020 1936.5593 867.9322 593.6931 586.1949 460.8289 1752.8809 720.9419 ## 2021 2463.1456 1078.7217 996.1128 924.2523 2033.1787 1301.2214 934.1477 ## Aug Sep Oct Nov Dec ## 2011 586.3581 2176.2413 787.3761 854.4358 513.2068 ## 2012 1339.7732 1507.8169 789.7558 883.7977 550.4838 ## 2013 2173.6578 1202.3046 933.7316 875.4979 548.6130 ## 2014 3114.2115 1200.3284 1157.9625 931.1027 691.0219 ## 2015 1729.1363 824.0283 995.3346 750.3287 538.4899 ## 2016 1145.6062 1048.3006 1050.2491 1005.0248 973.9955 ## 2017 1503.0438 1122.1439 1047.2614 883.3420 677.3816 ## 2018 1185.0947 1199.5619 1008.1251 776.0709 497.4198 ## 2019 1194.5156 1066.1918 1093.7082 771.6151 503.1632 ## 2020 934.1740 842.2214 604.4694 893.2831 502.3578 ## 2021 1017.1201
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 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2012 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2013 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2014 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2015 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2016 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2017 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2018 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2019 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2020 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## 2021 1833.10646 -89.51799 -440.43967 -408.46057 -443.36891 432.35660 ## Jul Aug Sep Oct Nov Dec ## 2011 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2012 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2013 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2014 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2015 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2016 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2017 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2018 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2019 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2020 757.67593 390.04691 -64.40352 -381.18432 -392.47592 -1193.33500 ## 2021 757.67593 390.04691
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$trend, type = 'l', col = 'red') lines(sumbarouttscomponents$trend, col = 'green') legend('right', c("Inflow","Outflow"),fill=c("red","green"))
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)
berikut adalah visualisasi dan prediksi data Inflow-Outflow di Sumatera :
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 = "steelblue")
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 4164.243 3337.607 4878.287 3156.548 3821.275 3686.394 4369.643
## 2012 7371.435 5443.242 5022.248 4102.575 5321.981 4064.952 5489.699
## 2013 13436.780 8035.017 7017.142 8267.947 7623.367 6961.815 7552.290
## 2014 11612.677 6964.701 5238.644 5988.730 4921.418 5591.202 3440.204
## 2015 12838.000 5173.687 5600.472 4954.255 5358.552 5936.657 15050.224
## 2016 13692.690 7760.507 6313.597 5254.795 6761.434 5066.314 20548.504
## 2017 12734.711 7752.686 7568.883 6638.224 7317.874 4071.240 21208.720
## 2018 16240.858 7668.179 7130.231 7628.992 5973.344 19402.076 14326.890
## 2019 17413.907 9281.546 8215.984 9406.456 7523.072 26667.739 11014.410
## 2020 19330.620 10365.349 7128.873 6536.998 7788.132 14946.781 8278.451
## 2021 21182.291 9983.745 8648.731 9095.626 16275.454 10211.629 6787.420
## Aug Sep Oct Nov Dec
## 2011 3668.498 12874.594 4776.883 5669.993 3496.335
## 2012 9422.659 6813.338 4563.922 5452.494 2842.029
## 2013 19523.108 5265.619 6181.279 5347.888 3157.046
## 2014 19746.407 6305.927 6798.485 5515.775 3899.380
## 2015 8915.131 5710.106 6763.497 6087.162 4161.556
## 2016 6548.412 7498.570 6952.295 6098.330 5268.100
## 2017 8722.990 8250.898 7610.729 7122.755 4748.106
## 2018 9119.047 8886.660 8429.308 8078.990 4610.368
## 2019 10707.883 9462.332 10195.256 8492.726 5380.872
## 2020 8012.437 7559.106 5735.149 8462.623 5200.062
## 2021 7085.136
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('blue','red'))
sumateraintscomponents <- decompose(sumaterainflowts)
sumateraintscomponents$seasonal
## Jan Feb Mar Apr May Jun
## 2011 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2012 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2013 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2014 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2015 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2016 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2017 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2018 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2019 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2020 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## 2021 6152.5962 -614.2449 -1728.6408 -1759.2576 -1797.7115 1972.5387
## Jul Aug Sep Oct Nov Dec
## 2011 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2012 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2013 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2014 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2015 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2016 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2017 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2018 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2019 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2020 3070.5444 2282.6974 -336.6473 -1439.1383 -1683.5836 -4119.1528
## 2021 3070.5444 2282.6974
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.06659603
## beta : FALSE
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 9834.706
sumaterasforecast$fitted
## Time Series:
## Start = 2
## End = 128
## Frequency = 1
## xhat level
## 2 4164.243 4164.243
## 3 4109.192 4109.192
## 4 4160.411 4160.411
## 5 4093.557 4093.557
## 6 4075.425 4075.425
## 7 4049.517 4049.517
## 8 4070.836 4070.836
## 9 4044.042 4044.042
## 10 4632.121 4632.121
## 11 4641.762 4641.762
## 12 4710.238 4710.238
## 13 4629.397 4629.397
## 14 4812.006 4812.006
## 15 4854.044 4854.044
## 16 4865.245 4865.245
## 17 4814.454 4814.454
## 18 4848.254 4848.254
## 19 4796.089 4796.089
## 20 4842.281 4842.281
## 21 5147.316 5147.316
## 22 5258.266 5258.266
## 23 5212.026 5212.026
## 24 5228.040 5228.040
## 25 5069.141 5069.141
## 26 5626.392 5626.392
## 27 5786.797 5786.797
## 28 5868.733 5868.733
## 29 6028.511 6028.511
## 30 6134.722 6134.722
## 31 6189.803 6189.803
## 32 6280.540 6280.540
## 33 7162.442 7162.442
## 34 7036.121 7036.121
## 35 6979.192 6979.192
## 36 6870.554 6870.554
## 37 6623.249 6623.249
## 38 6955.525 6955.525
## 39 6956.136 6956.136
## 40 6841.758 6841.758
## 41 6784.950 6784.950
## 42 6660.846 6660.846
## 43 6589.612 6589.612
## 44 6379.874 6379.874
## 45 7270.032 7270.032
## 46 7205.826 7205.826
## 47 7178.699 7178.699
## 48 7067.955 7067.955
## 49 6856.940 6856.940
## 50 7255.255 7255.255
## 51 7116.631 7116.631
## 52 7015.661 7015.661
## 53 6878.379 6878.379
## 54 6777.165 6777.165
## 55 6721.190 6721.190
## 56 7275.871 7275.871
## 57 7385.039 7385.039
## 58 7273.495 7273.495
## 59 7239.531 7239.531
## 60 7162.788 7162.788
## 61 6962.918 6962.918
## 62 7411.094 7411.094
## 63 7434.364 7434.364
## 64 7359.725 7359.725
## 65 7219.545 7219.545
## 66 7189.037 7189.037
## 67 7047.672 7047.672
## 68 7946.774 7946.774
## 69 7853.648 7853.648
## 70 7830.001 7830.001
## 71 7771.550 7771.550
## 72 7660.120 7660.120
## 73 7500.821 7500.821
## 74 7849.377 7849.377
## 75 7842.938 7842.938
## 76 7824.687 7824.687
## 77 7745.673 7745.673
## 78 7717.184 7717.184
## 79 7474.378 7474.378
## 80 8389.031 8389.031
## 81 8411.271 8411.271
## 82 8400.591 8400.591
## 83 8347.989 8347.989
## 84 8266.394 8266.394
## 85 8032.090 8032.090
## 86 8578.761 8578.761
## 87 8518.120 8518.120
## 88 8425.692 8425.692
## 89 8372.635 8372.635
## 90 8212.852 8212.852
## 91 8958.009 8958.009
## 92 9315.556 9315.556
## 93 9302.469 9302.469
## 94 9274.778 9274.778
## 95 9218.473 9218.473
## 96 9142.588 9142.588
## 97 8840.760 8840.760
## 98 9411.697 9411.697
## 99 9403.030 9403.030
## 100 9323.977 9323.977
## 101 9329.470 9329.470
## 102 9209.171 9209.171
## 103 10371.842 10371.842
## 104 10414.635 10414.635
## 105 10434.164 10434.164
## 106 10369.444 10369.444
## 107 10357.844 10357.844
## 108 10233.634 10233.634
## 109 9910.460 9910.460
## 110 10537.805 10537.805
## 111 10526.320 10526.320
## 112 10300.064 10300.064
## 113 10049.458 10049.458
## 114 9898.863 9898.863
## 115 10235.034 10235.034
## 116 10104.734 10104.734
## 117 9965.395 9965.395
## 118 9805.146 9805.146
## 119 9534.100 9534.100
## 120 9462.744 9462.744
## 121 9178.866 9178.866
## 122 9978.247 9978.247
## 123 9978.613 9978.613
## 124 9890.048 9890.048
## 125 9837.143 9837.143
## 126 10265.909 10265.909
## 127 10262.294 10262.294
## 128 10030.881 10030.881
plot(sumaterasforecast)
sumaterasforecast$SSE
## [1] 2341841644
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.1439112
## beta : FALSE
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 570.7609
sumaterasforecast$fitted
## xhat level
## Feb 2011 6152.596200 6152.596200
## Mar 2011 5178.772022 5178.772022
## Apr 2011 4184.717991 4184.717991
## May 2011 3329.313367 3329.313367
## Jun 2011 2591.477097 2591.477097
## Jul 2011 2502.404938 2502.404938
## Aug 2011 2584.166572 2584.166572
## Sep 2011 2540.781776 2540.781776
## Oct 2011 2126.687515 2126.687515
## Nov 2011 1613.525270 1613.525270
## Dec 2011 1139.034395 1139.034395
## Jan 2012 382.322403 382.322403
## Feb 2012 1212.729396 1212.729396
## Mar 2012 949.807349 949.807349
## Apr 2012 564.348674 564.348674
## May 2012 229.955722 229.955722
## Jun 2012 -61.848288 -61.848288
## Jul 2012 230.922777 230.922777
## Aug 2012 639.576122 639.576122
## Sep 2012 876.039660 876.039660
## Oct 2012 701.520424 701.520424
## Nov 2012 393.455678 393.455678
## Dec 2012 94.546475 94.546475
## Jan 2013 -511.852013 -511.852013
## Feb 2013 447.236688 447.236688
## Mar 2013 294.477610 294.477610
## Apr 2013 3.328221 3.328221
## May 2013 -250.327608 -250.327608
## Jun 2013 -473.013470 -473.013470
## Jul 2013 -121.071133 -121.071133
## Aug 2013 338.238076 338.238076
## Sep 2013 618.067532 618.067532
## Oct 2013 480.673373 480.673373
## Nov 2013 204.390990 204.390990
## Dec 2013 -67.309688 -67.309688
## Jan 2014 -650.415263 -650.415263
## Feb 2014 328.614241 328.614241
## Mar 2014 192.926262 192.926262
## Apr 2014 -83.608752 -83.608752
## May 2014 -324.753377 -324.753377
## Jun 2014 -536.728538 -536.728538
## Jul 2014 -175.616889 -175.616889
## Aug 2014 291.542064 291.542064
## Sep 2014 578.091599 578.091599
## Oct 2014 446.450425 446.450425
## Nov 2014 175.093107 175.093107
## Dec 2014 -92.391278 -92.391278
## Jan 2015 -671.887331 -671.887331
## Feb 2015 310.232244 310.232244
## Mar 2015 177.189640 177.189640
## Apr 2015 -97.080698 -97.080698
## May 2015 -336.286559 -336.286559
## Jun 2015 -546.601967 -546.601967
## Jul 2015 -184.069420 -184.069420
## Aug 2015 284.305947 284.305947
## Sep 2015 571.896840 571.896840
## Oct 2015 441.147161 441.147161
## Nov 2015 170.553042 170.553042
## Dec 2015 -96.277977 -96.277977
## Jan 2016 -675.214690 -675.214690
## Feb 2016 307.383729 307.383729
## Mar 2016 174.751058 174.751058
## Apr 2016 -99.168341 -99.168341
## May 2016 -338.073767 -338.073767
## Jun 2016 -548.131975 -548.131975
## Jul 2016 -185.379243 -185.379243
## Aug 2016 283.184622 283.184622
## Sep 2016 570.936886 570.936886
## Oct 2016 440.325355 440.325355
## Nov 2016 169.849503 169.849503
## Dec 2016 -96.880268 -96.880268
## Jan 2017 -675.730305 -675.730305
## Feb 2017 306.942316 306.942316
## Mar 2017 174.373170 174.373170
## Apr 2017 -99.491846 -99.491846
## May 2017 -338.350716 -338.350716
## Jun 2017 -548.369068 -548.369068
## Jul 2017 -185.582216 -185.582216
## Aug 2017 283.010859 283.010859
## Sep 2017 570.788130 570.788130
## Oct 2017 440.198007 440.198007
## Nov 2017 169.740481 169.740481
## Dec 2017 -96.973601 -96.973601
## Jan 2018 -675.810206 -675.810206
## Feb 2018 306.873914 306.873914
## Mar 2018 174.314611 174.314611
## Apr 2018 -99.541977 -99.541977
## May 2018 -338.393633 -338.393633
## Jun 2018 -548.405809 -548.405809
## Jul 2018 -185.613670 -185.613670
## Aug 2018 282.983932 282.983932
## Sep 2018 570.765078 570.765078
## Oct 2018 440.178272 440.178272
## Nov 2018 169.723587 169.723587
## Dec 2018 -96.988064 -96.988064
## Jan 2019 -675.822588 -675.822588
## Feb 2019 306.863314 306.863314
## Mar 2019 174.305537 174.305537
## Apr 2019 -99.549746 -99.549746
## May 2019 -338.400284 -338.400284
## Jun 2019 -548.411502 -548.411502
## Jul 2019 -185.618544 -185.618544
## Aug 2019 282.979760 282.979760
## Sep 2019 570.761506 570.761506
## Oct 2019 440.175214 440.175214
## Nov 2019 169.720969 169.720969
## Dec 2019 -96.990305 -96.990305
## Jan 2020 -675.824506 -675.824506
## Feb 2020 306.861672 306.861672
## Mar 2020 174.304131 174.304131
## Apr 2020 -99.550950 -99.550950
## May 2020 -338.401314 -338.401314
## Jun 2020 -548.412385 -548.412385
## Jul 2020 -185.619299 -185.619299
## Aug 2020 282.979113 282.979113
## Sep 2020 570.760952 570.760952
## Oct 2020 440.174740 440.174740
## Nov 2020 169.720563 169.720563
## Dec 2020 -96.990652 -96.990652
## Jan 2021 -675.824804 -675.824804
## Feb 2021 306.861417 306.861417
## Mar 2021 174.303913 174.303913
## Apr 2021 -99.551136 -99.551136
## May 2021 -338.401474 -338.401474
## Jun 2021 -548.412521 -548.412521
## Jul 2021 -185.619416 -185.619416
## Aug 2021 282.979013 282.979013
plot(sumaterasforecast)
sumaterasforecast$SSE
## [1] 1194469870
library(forecast)
## Warning: package 'forecast' was built under R version 4.1.2
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
dftimeseries.hw <- HoltWinters(Sumaterats, gamma = FALSE)
sumateratsforecasts2 <- forecast(dftimeseries.hw, h = 20)
sumateratsforecasts2
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 129 9997.253 4108.913 15885.59 991.81479 19002.69
## 130 10346.320 4429.817 16262.82 1297.80961 19394.83
## 131 10695.388 4723.253 16667.52 1561.79563 19828.98
## 132 11044.455 4980.734 17108.18 1770.79433 20318.12
## 133 11393.522 5194.815 17592.23 1913.41811 20873.63
## 134 11742.589 5359.473 18125.71 1980.45472 21504.72
## 135 12091.657 5470.376 18712.94 1965.28137 22218.03
## 136 12440.724 5524.979 19356.47 1864.00537 23017.44
## 137 12789.791 5522.420 20057.16 1675.30680 23904.28
## 138 13138.858 5463.258 20814.46 1400.04106 24877.68
## 139 13487.926 5349.129 21626.72 1040.70995 25935.14
## 140 13836.993 5182.386 22491.60 600.91363 27073.07
## 141 14186.060 4965.785 23406.34 84.86612 28287.25
## 142 14535.127 4702.235 24368.02 -502.98447 29573.24
## 143 14884.195 4394.621 25373.77 -1158.22393 30926.61
## 144 15233.262 4045.697 26420.83 -1876.64233 32343.17
## 145 15582.329 3658.020 27506.64 -2654.32868 33818.99
## 146 15931.397 3233.924 28628.87 -3487.71237 35350.51
## 147 16280.464 2775.517 29785.41 -4373.57000 36934.50
## 148 16629.531 2284.689 30974.37 -5309.01154 38568.07
plot(sumateratsforecasts2)
sumateratsdiff1 <- diff(Sumaterats, differences = 1)
plot.ts(sumateratsdiff1)
acf(sumateratsdiff1, lag.max = 20)
Referensi |