Lembaga : Universitas Islam Negeri Maulana Malik Ibrahim Malang

Fakultas : Sains dan Teknologi

Jurusan : Teknik Informatika

Mata Kuliah : Linier Algebra

0.1 Pengertian inflow dan outflow Uang Kartal

Inflow merupakan uang yang masuk ke BI melalui kegiatan penyetoran, sedangkan outflow merupakan uang yang keluar dari BI melalui kegiatan penarikan. Adapun contoh penerapan visualisasi prediksi data inflow & outflow pada Sumatera Utara dengan menggunakan pemerograman pada Bahasa R adalah sebagai berikut:

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.2 Visualisasi Prediksi Data Inflow Uang Kartal Sumatera Utara Setiap Periode

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

0.3 Visualisasi Prediksi Data Outflow Uang Kartal di Sumatera Utara Setiap Periode

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

0.4 Visualisasi Prediksi Data Inflow-Outflow Uang Kartal di Sumatera Utara Setiap Periode

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

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

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

logSumateraUtara <- log(datainflowperbulan$`Sumatera Utara`)
plot.ts(logSumateraUtara)

0.6 ** Visualisasi Prediksi Data Inflow-Outflow Time Series Uang Kartal di Sumatera Utara**

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

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

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

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

plot.ts(SumateraUtaraoutflowtimeseries)

SumateraUtaraintimeseriescomponents <- decompose(SumateraUtarainflowtimeseries)
SumateraUtaraintimeseriescomponents$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

SumateraUtaraouttimeseriescomponents <- decompose(SumateraUtaraoutflowtimeseries)
SumateraUtaraouttimeseriescomponents$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(SumateraUtaraintimeseriescomponents$seasonal,type = "l", col = "orange")
lines(SumateraUtaraouttimeseriescomponents$seasonal,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("orange","blue"))

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

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

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