Lembaga : Universitas Islam Negeri Maulana Malik Ibrahim Malang

Fakultas : Sains dan Teknologi

Jurusan : Teknik Informatika

Mata Kuliah : Linier Algebra

Berikut contoh penerapan visualisasi prediksi data inflow & outflow pada sumatera barat dengan menggunakan pemerograman pada Bahasa R

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 Sumatera Barat Setiap Periode

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

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

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

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

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

0.4 4. Visualisasi Prediksi Data Inflow-Outflow Uang Kartal di Sumatera Barat 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$`Sumatera Barat`, type = "l", col = "red")
lines(dataoutflowperbulan$`Sumatera Barat`,col="yellow")
legend("top",c("Inflow","Outflow"),fill=c("red","yellow"))

SumateraBarattimeseries <- datainflowperbulan$`Sumatera Barat`
plot.ts(SumateraBarattimeseries , type = "l", col = "green")

logSumateraBarat <- log(datainflowperbulan$`Sumatera Barat`)
plot.ts(logSumateraBarat)

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

SumateraBaratinflowtimeseries <- ts(datainflowperbulan$`Sumatera Barat`, frequency=12, start=c(2011,1))
SumateraBaratinflowtimeseries

##            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

SumateraBaratoutflowtimeseries <- ts(dataoutflowperbulan$`Sumatera Barat`, frequency=12, start=c(2011,1))
SumateraBaratoutflowtimeseries

##             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(SumateraBaratinflowtimeseries)

plot.ts(SumateraBaratoutflowtimeseries)

SumateraBaratintimeseriescomponents <- decompose(SumateraBaratinflowtimeseries)
SumateraBaratintimeseriescomponents$seasonal

##             Jan        Feb        Mar        Apr        May        Jun
## 2011  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2012  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2013  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2014  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2015  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2016  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2017  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2018  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2019  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2020  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
## 2021  677.50012 -167.90248 -240.27096 -255.95989 -254.27532  231.31747
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2012  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2013  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2014  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2015  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2016  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2017  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2018  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2019  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2020  527.87634  371.73426   96.85991 -177.47315 -269.01396 -540.39235
## 2021  527.87634  371.73426

SumateraBaratouttimeseriescomponents <- decompose(SumateraBaratoutflowtimeseries)
SumateraBaratouttimeseriescomponents$seasonal

##             Jan        Feb        Mar        Apr        May        Jun
## 2011 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2012 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2013 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2014 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2015 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2016 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2017 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2018 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2019 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2020 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
## 2021 -535.28958 -328.69192 -132.69390  -49.10511  545.48678  538.93605
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2012  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2013  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2014  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2015  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2016  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2017  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2018  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2019  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2020  171.98463  -44.52431 -321.49495 -208.98678 -160.73573  525.11481
## 2021  171.98463  -44.52431

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

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

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

plot(SumateraBaratintimeseriescomponents$figure ,type = "l", col = "orange")
lines(SumateraBaratouttimeseriescomponents$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