Lembaga : Universitas Islam Negeri Maulana Malik Ibrahim Malang

Fakultas : Sains dan Teknologi

Jurusan : Teknik Informatika

Mata Kuliah : Linier Algebra

library(readxl)

## Warning: package 'readxl' was built under R version 4.1.2

datainflow <- read_excel(path = "inflow sumatera.xlsx")
datainflow

## # A tibble: 11 x 12
##    Tahun Sumatera   Aceh `Sumatera Utara` `Sumatera Barat`   Riau `Kep. Riau`
##    <dbl>    <dbl>  <dbl>            <dbl>            <dbl>  <dbl>       <dbl>
##  1  2011   57900.  2308.           23238.            9385.  3012.       1426.
##  2  2012   65911.  2620.           25981.           11192.  4447.       2236.
##  3  2013   98369. 36337.           18120.           14056.  8933.       3378.
##  4  2014   86024.  4567.           30503.           14103.  6358.       2563.
##  5  2015   86549.  4710.           30254.           13309.  7156.       3218.
##  6  2016   97764.  5775.           34427.           14078.  8211.       4317.
##  7  2017  103748.  5514.           35617.           15312.  8553.       4412.
##  8  2018  117495.  5799.           41769.           15058. 10730.       5134.
##  9  2019  133762.  7509.           47112.           14750. 10915.       6077.
## 10  2020  109345.  6641.           36609.           10696.  9148.       6175.
## 11  2021   89270.  3702.           31840.           10748.  7769.       5009.
## # ... with 5 more variables: Jambi <dbl>, `Sumatera Selatan` <dbl>,
## #   Bengkulu <dbl>, Lampung <dbl>, `Kep. Bangka Bellitung` <dbl>

library(readxl)
dataoutflow <- read_excel(path = "outflow sumatera.xlsx")
dataoutflow

## # A tibble: 11 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.
## # ... with 5 more variables: Jambi <dbl>, `Sumatera Selatan` <dbl>,
## #   Bengkulu <dbl>, Lampung <dbl>, `Kep. Bangka Bellitung` <dbl>

0.1 1.Visualisasi Prediksi Data Inflow Uang Kartal Riau Setiap Periode

plot(datainflow$Tahun,datainflow$`Riau`,type = "l", col= "steelblue")

0.2 2.Visualisasi Prediksi Data Outflow Uang Kartal di Riau Setiap Periode

plot(dataoutflow$Tahun,dataoutflow$`Riau`,type = "l", col= "red")

0.3 3.Visualisasi Prediksi Data Inflow-Outflow Uang Kartal di Riau Setiap Periode

plot(datainflow$Tahun,datainflow$`Riau`,type = "l", col= "steelblue")
lines(dataoutflow$Tahun,dataoutflow$`Riau`,col="red")
legend("top",c("Inflow","Outflow"),fill=c("steelblue","red"))

0.4 4. Visualisasi Prediksi Data Inflow-Outflow Uang Kartal di Riau Setiap Bulan

library(readxl)
datainflowperbulan <- read_excel(path = "inflowbulanan.xlsx")
dataoutflowperbulan <- read_excel(path = "outflowbulanan.xlsx")
datainflowperbulan

## # A tibble: 128 x 12
##    Bulanan             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

## # A tibble: 128 x 12
##    Bulanan             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(datainflowperbulan$`Riau`, type = "l", col = "red")
lines(dataoutflowperbulan$`Riau`,col="yellow")
legend("top",c("Inflow","Outflow"),fill=c("red","yellow"))

Riautimeseries <- datainflowperbulan$`Riau`
plot.ts(Riautimeseries , type = "l", col = "green")

logRiau <- log(datainflowperbulan$`Riau`)
plot.ts(logRiau)

0.5 5. Visualisasi Prediksi Data Inflow-Outflow Time Series Uang Kartal di Riau

Riauinflowtimeseries <- ts(datainflowperbulan$`Riau`, frequency=12, start=c(2011,1))
Riauinflowtimeseries

##             Jan        Feb        Mar        Apr        May        Jun
## 2011   94.24460   96.39424  287.98845  160.06180  194.70583  100.67608
## 2012  445.71970  364.44861  274.48827  235.70588  341.36393  250.99083
## 2013 1548.75771  724.83408  666.22356 1146.69694  714.10313  628.70916
## 2014  897.55475  597.76572  391.46587  414.92963  399.11419  324.09467
## 2015 1095.88812  347.44105  369.02908  424.74718  505.67346  498.57889
## 2016 1332.16109  622.76483  564.49565  377.26617  501.64829  415.02464
## 2017 1228.76098  692.52354  787.21834  671.46804  700.20181  173.00907
## 2018 1545.34390  887.66466  697.71403  627.84201  422.92181 1972.65304
## 2019 1663.41486  723.68853  671.06970  670.02297  372.20685 2633.04629
## 2020 1566.80990  900.25231  656.60197  465.35740  832.48125 1646.18946
## 2021 2241.25936  910.24470  683.86349  608.93339 1522.46355  829.78643
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  143.32160  134.02960 1013.73676  341.22178  285.25779  160.83875
## 2012  390.91878  802.77936  408.83238  299.94057  391.02488  241.07860
## 2013  666.15895 1389.62436  454.88185  526.87296  302.26685  164.31963
## 2014  230.89241 1726.82385  377.03621  427.15336  334.94644  236.43117
## 2015 1399.11338  924.21942  357.65246  492.53688  457.74194  283.85194
## 2016 1858.40120  454.01158  563.71821  617.78181  426.00867  477.63763
## 2017 2114.71229  662.80534  502.47310  396.17308  428.57649  195.45782
## 2018 1293.01149  794.86546  685.77238  761.58086  774.35900  265.80837
## 2019  792.15569  841.10671  817.22178  825.61507  713.15676  192.69741
## 2020  754.19735  643.18320  372.80961  524.47867  611.53183  174.17311
## 2021  454.26751  518.24240

Riauoutflowtimeseries <- ts(dataoutflowperbulan$`Riau`, frequency=12, start=c(2011,1))
Riauoutflowtimeseries

##             Jan        Feb        Mar        Apr        May        Jun
## 2011  478.18402  400.24595  621.35321 1005.56107 1000.35374 1365.96130
## 2012  292.47450  399.76750  880.86006 1049.68113 1055.29479 1142.69911
## 2013  116.34632  569.05345 2345.35727  412.85210 1045.96329 1004.92649
## 2014  517.96101  526.24079 1089.97967 1000.53879 1182.86056 1199.39334
## 2015  133.58209  757.00411 1048.19275 1317.24918 1173.47065 1965.00327
## 2016  264.81101  670.51938  998.35476 1250.91662 1523.48445 4170.88866
## 2017  733.56292  981.17365 1359.41399 1239.79585 1413.94085 3856.69476
## 2018  233.11415 1118.03060 1545.86969 1215.64481 2476.59753 3343.03974
## 2019  455.48443 1012.74002 1340.33344 1521.82191 4902.80531  241.49091
## 2020  739.71921  831.87016 1264.41224 1774.60350 2925.82841  282.77052
## 2021  311.09352  805.14586 1430.24476 2632.46893 3111.28761 1073.67143
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  815.43379 2729.10217  154.42178  829.93388  873.64100 2159.95096
## 2012 1196.25287 2392.32861  381.04524  883.96286  968.57206 2370.85940
## 2013 1473.20994 1758.54800  892.49248 1341.31082 1558.92781 2941.37515
## 2014 3974.55298   13.89336  971.59826  969.79530 1076.07146 2634.65301
## 2015 3286.54673  393.89838  718.78270  935.00142 1054.45513 3005.38270
## 2016  515.04790 1100.53865 1629.71683 1273.01584 1438.08721 2809.65000
## 2017  330.25241 1530.30977  896.72821 1317.25781 1705.10587 2763.50350
## 2018  735.25593 1364.76585  955.53100 1303.13335 1240.43316 2394.18052
## 2019 1223.33771 1452.78989 1124.43995 1242.01385 1649.73723 3110.25361
## 2020 1530.19271 1470.10144 1394.12769 2017.60832 1409.04284 3498.29809
## 2021 1692.92089 1573.91533

plot.ts(Riauinflowtimeseries)

plot.ts(Riauoutflowtimeseries)

Riauintimeseriescomponents <- decompose(Riauinflowtimeseries)
Riauintimeseriescomponents$seasonal

##             Jan        Feb        Mar        Apr        May        Jun
## 2011  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2012  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2013  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2014  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2015  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2016  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2017  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2018  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2019  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2020  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
## 2021  657.38978  -24.91095 -126.73102 -129.53109 -159.03686  256.34435
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2012  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2013  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2014  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2015  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2016  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2017  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2018  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2019  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2020  306.31477  167.03441 -119.93753 -157.53528 -213.78634 -455.61424
## 2021  306.31477  167.03441

Riauouttimeseriescomponents <- decompose(Riauoutflowtimeseries)
Riauouttimeseriescomponents$seasonal

##              Jan         Feb         Mar         Apr         May         Jun
## 2011 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2012 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2013 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2014 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2015 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2016 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2017 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2018 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2019 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2020 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
## 2021 -1029.68788  -641.19116   -51.82000  -184.13231   576.46181   512.97160
##              Jul         Aug         Sep         Oct         Nov         Dec
## 2011   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2012   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2013   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2014   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2015   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2016   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2017   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2018   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2019   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2020   140.29335    51.92179  -461.87487  -172.60911  -102.07941  1361.74622
## 2021   140.29335    51.92179

plot(Riauintimeseriescomponents$seasonal,type = "l", col = "orange")
lines(Riauouttimeseriescomponents$seasonal,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("orange","blue"))

plot(Riauintimeseriescomponents$trend,type = "l", col = "orange")
lines(Riauouttimeseriescomponents$trend,col="grey")
legend("top",c("Inflow","Outflow"),fill=c("orange","grey"))

plot(Riauintimeseriescomponents$random ,type = "l", col = "black")
lines(Riauouttimeseriescomponents$random,col="grey")
legend("top",c("Inflow","Outflow"),fill=c("black","grey"))

plot(Riauintimeseriescomponents$figure ,type = "l", col = "orange")
lines(Riauouttimeseriescomponents$figure,col="grey")
legend("top",c("Inflow","Outflow"),fill=c("orange","grey"))

#Referensi

https://ejurnal.its.ac.id/index.php/sains_seni/article/download/12401/2433#:

https://www.bi.go.id/id/fungsi-utama/sistem-pembayaran/pengelolaan-rupiah/default.aspx

https://rpubs.com/suhartono-uinmaliki/861286