Dosen Pengempu : Prof. Dr. Suhartono, M.Kom

UIN Maulana Malik Ibrahim Malang - Teknik Informatika

Data Beberapa Wilayah di Sumatera

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

Data Inflow

datainflowkelasC <- read_excel(path = "C:/Users/ASUS PC/Documents/BUKU NOVA/RStudio/RMarkdown/kelascup.xlsx")
datainflowkelasC
## # A tibble: 11 x 12
##    Keterangan Sumatera   Aceh `Sumatera Utara` `Sumatera Barat`   Riau
##         <dbl>    <dbl>  <dbl>            <dbl>            <dbl>  <dbl>
##  1       2011   57900.  2308.           23238.            9385.  3012.
##  2       2012   65911.  2620.           25981.           11192.  4447.
##  3       2013   98369. 36337.           18120.           14056.  8933.
##  4       2014   86024.  4567.           30503.           14103.  6358.
##  5       2015   86549.  4710.           30254.           13309.  7156.
##  6       2016   97764.  5775.           34427.           14078.  8211.
##  7       2017  103748.  5514.           35617.           15312.  8553.
##  8       2018  117495.  5799.           41769.           15058. 10730.
##  9       2019  133762.  7509.           47112.           14750. 10915.
## 10       2020  109345.  6641.           36609.           10696.  9148.
## 11       2021   89270.  3702.           31840.           10748.  7769.
## # ... with 6 more variables: Kep. Riau <dbl>, Jambi <dbl>,
## #   Sumatera Selatan <dbl>, Bengkulu <dbl>, Lampung <dbl>,
## #   Kep. Bangka Belitung <dbl>

Data Outflow

dataoutflowkelasB <- read_excel(path = "C:/Users/ASUS PC/Documents/BUKU NOVA/RStudio/RMarkdown/kelasout.xlsx")
dataoutflowkelasB
## # A tibble: 11 x 12
##    Keterangan Sumatera   Aceh `Sumatera Utara` `Sumatera Barat`   Riau
##         <dbl>    <dbl>  <dbl>            <dbl>            <dbl>  <dbl>
##  1       2011   80092.  6338.           22176.            5300. 12434.
##  2       2012   85235.  6378.           22495.            6434. 13014.
##  3       2013  103288. 23278.           19235.            6511. 15460.
##  4       2014  102338.  8630.           26391.            7060. 15158.
##  5       2015  109186.  9637.           27877.            7471. 15789.
##  6       2016  121992. 11311.           31959.            9198. 17645.
##  7       2017  133606. 11760.           35243.           10754. 18128.
##  8       2018  135676. 11450.           36908.            8447. 17926.
##  9       2019  153484. 13087.           44051.            9465. 19277.
## 10       2020  140589. 12874.           39758.            8763. 19139.
## 11       2021   86627.  5770.           23453.            5941. 12631.
## # ... with 6 more variables: Kep. Riau <dbl>, Jambi <dbl>,
## #   Sumatera Selatan <dbl>, Bengkulu <dbl>, Lampung <dbl>,
## #   Kep. Bangka Belitung <dbl>

Visualisasi dan Prediksi Inflow di Daerah Kep.Bangka Belitung

datainflowkelasC$`Kep. Bangka Belitung`
##  [1]    0.00000    0.00000    0.00000   13.70908 1176.58339 1544.20832
##  [7] 1163.50693 1517.42196 3265.10361 2562.09436 1259.21009
plot(datainflowkelasC$`Kep. Bangka Belitung`, type = "l", col = "red")

Visualisasi dan Prediksi Outflow di Daerah Kep.Bangka Belitung

dataoutflowkelasB$`Kep. Bangka Belitung`
##  [1]    0.0000    0.0000    0.0000  322.0841 2004.7861 2683.7941 2750.0952
##  [8] 2737.6852 4167.0982 3898.5512 3492.5938
plot(dataoutflowkelasB$`Kep. Bangka Belitung`, type = "l", col = "blue")

Visualisasi dan Prediksi Inflow-Outflow di Daerah Kep.Bangka Belitung Setiap Periode

plot(datainflowkelasC$`Kep. Bangka Belitung`, type = "l", col = "red")
lines(dataoutflowkelasB$`Kep. Bangka Belitung`, type = "l", col = "blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

Data pada Beberapa Wilayah di Sumatera Setiap Bulan

Data Inflow PerBulan

datainflowperbulan <- read_excel(path = "C:/Users/ASUS PC/Documents/BUKU NOVA/RStudio/RMarkdown/InflowperBulan.xlsx")
dataoutflowperbulan <- read_excel(path = "C:/Users/ASUS PC/Documents/BUKU NOVA/RStudio/RMarkdown/OutflowperBulan.xlsx")
datainflowperbulan
## # A tibble: 128 x 12
##    Keterangan          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>

Data Outflow PerBulan

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

Visualisasi dan Prediksi Inflow-Outflow di Daerah Kep.Bangka Belitung pada Setiap Bulan

plot(datainflowperbulan$`Kep. Bangka Belitung`, type = "l", col = "red")
lines(dataoutflowperbulan$`Kep. Bangka Belitung`,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

Time Series dan Log pada daerah Kep.Bangka Belitung

Kep.BangkaBelitungtimeseries <- datainflowperbulan$`Kep. Bangka Belitung`
plot.ts(Kep.BangkaBelitungtimeseries , type = "l", col = "green")

logKep.BangkaBelitung <- log(datainflowperbulan$`Kep. Bangka Belitung`)
plot.ts(logKep.BangkaBelitung)

library(TTR)
## Warning: package 'TTR' was built under R version 4.1.2
SumateraBaratSMA3 <- SMA(datainflowperbulan$`Sumatera Barat` ,n=3)
plot.ts(SumateraBaratSMA3 )

library("TTR")
Kep.BangkaBelitungSMA3 <- SMA(datainflowperbulan$`Kep. Bangka Belitung` ,n=8)
plot.ts(Kep.BangkaBelitungSMA3 )

Visualisasi Prediksi Data Inflow-Outflow Time Series Uang Kartal di Daerah Kep.Bangka Belitung

Inflow TimeSeries
Kep.BangkaBelitunginflowtimeseries <- ts(datainflowperbulan$`Kep. Bangka Belitung`, frequency=12, start=c(2011,1))
Kep.BangkaBelitunginflowtimeseries
##             Jan        Feb        Mar        Apr        May        Jun
## 2011   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2012   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2013   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2014   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2015 187.639957  33.147896 114.451087  78.250445  30.909939  92.942037
## 2016 340.792357 166.304876  85.640498  49.255930 114.320505  75.598373
## 2017 201.271938 110.302500  58.276958  28.704962  81.210205  41.263221
## 2018 306.662249  54.452683  55.611933  69.022908  54.486720 283.237018
## 2019 309.413941 301.696986 213.049668 247.041834 190.930447 725.701711
## 2020 458.198210 275.503586 153.561979 238.759146 253.398617 471.739983
## 2021 381.984491  92.951196  93.798544  91.820055 362.027685  84.895245
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2012   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2013   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000
## 2014   0.000000   0.000000   0.000000   0.000000   8.583950   5.125127
## 2015 291.012814  36.621340  68.667292 128.247156  99.552693  15.140736
## 2016 449.106283  28.370724 133.889548  41.285099  25.777118  33.867005
## 2017 358.088421  58.774292  93.159671  41.415730  81.863243   9.175790
## 2018 192.789235 125.814197  83.299065 149.917111  76.593131  65.535710
## 2019 268.101638 294.219489 238.370988 181.142442 176.158614 119.275850
## 2020 179.706885 151.857426 129.829668  78.321303 126.068162  45.149398
## 2021  68.830158  82.902713
plot.ts(Kep.BangkaBelitunginflowtimeseries)

Outflow TimeSeries
Kep.BangkaBelitungoutflowtimeseries <- ts(dataoutflowperbulan$`Kep. Bangka Belitung`, frequency=12, start=c(2011,1))
Kep.BangkaBelitungoutflowtimeseries
##              Jan         Feb         Mar         Apr         May         Jun
## 2011    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2012    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2013    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2014    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2015    7.212591  100.722316   88.242902  119.734077  108.562288  141.922856
## 2016   62.511019   74.673600   73.366989  137.419284  187.254674  593.621546
## 2017   99.053103  107.190457  154.892432  219.087363  237.040453  685.029330
## 2018   45.294821  141.372517  163.027297  210.937666  447.089850  545.359260
## 2019  213.935303  151.205232  311.646991  381.732526 1149.153997   78.513581
## 2020  125.859564  120.611445  347.011532  292.171852  672.792344   28.320067
## 2021   38.406031  155.960921  473.816286  677.957705  731.426761  423.292681
##              Jul         Aug         Sep         Oct         Nov         Dec
## 2011    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2012    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2013    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000
## 2014    0.000000    0.000000    0.000000    0.000000   20.158561  301.925528
## 2015  461.459620  247.654498  145.109007   62.885310  180.503866  340.776774
## 2016  209.427034  276.657814  271.424057  153.904316  279.301232  364.232562
## 2017   31.018723  219.679759   53.315563  209.534771  226.055188  508.198084
## 2018  168.913022  197.022225  115.023134  225.510779  245.110586  233.024001
## 2019  354.451123  295.839540  171.788886  243.712926  269.138995  545.979144
## 2020  320.609406  136.901740  297.384179  471.479842  258.876760  826.532469
## 2021  494.593107  497.140310
plot.ts(Kep.BangkaBelitungoutflowtimeseries)

Visualisasi Prediksi Data Inflow-Outflow Time Series Komponen Uang Kartal di Daerah Kep.Bangka Belitung

Inflow Time Series Komponen

Kep.BangkaBelitungintimeseriescomponents <- decompose(Kep.BangkaBelitunginflowtimeseries)
Kep.BangkaBelitungintimeseriescomponents$seasonal
##              Jan         Feb         Mar         Apr         May         Jun
## 2011 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2012 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2013 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2014 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2015 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2016 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2017 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2018 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2019 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2020 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
## 2021 115.0550050  -0.7375573 -25.9024253 -23.4835202 -22.8496336  83.6050158
##              Jul         Aug         Sep         Oct         Nov         Dec
## 2011  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2012  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2013  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2014  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2015  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2016  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2017  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2018  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2019  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2020  78.2633854 -28.0302942 -23.6525417 -37.1146917 -41.5789170 -73.5738251
## 2021  78.2633854 -28.0302942

Outflow Time Series Komponen

Kep.BangkaBelitungouttimeseriescomponents <- decompose(Kep.BangkaBelitungoutflowtimeseries)
Kep.BangkaBelitungouttimeseriescomponents$seasonal
##              Jan         Feb         Mar         Apr         May         Jun
## 2011 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2012 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2013 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2014 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2015 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2016 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2017 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2018 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2019 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2020 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
## 2021 -116.451749  -94.637566  -27.708893   -6.502379  150.206433   64.167283
##              Jul         Aug         Sep         Oct         Nov         Dec
## 2011    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2012    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2013    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2014    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2015    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2016    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2017    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2018    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2019    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2020    1.650183  -16.372014  -50.967161  -24.467907  -19.128618  140.212388
## 2021    1.650183  -16.372014

Grafik TimeSeries Kep.Bangka Belitung

plot(Kep.BangkaBelitungintimeseriescomponents$seasonal,type = "l", col = "red")
lines(Kep.BangkaBelitungouttimeseriescomponents$seasonal,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

plot(Kep.BangkaBelitungintimeseriescomponents$trend,type = "l", col = "red")
lines(Kep.BangkaBelitungouttimeseriescomponents$trend,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

plot(Kep.BangkaBelitungintimeseriescomponents$random ,type = "l", col = "red")
lines(Kep.BangkaBelitungouttimeseriescomponents$random,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

plot(Kep.BangkaBelitungintimeseriescomponents$figure ,type = "l", col = "red")
lines(Kep.BangkaBelitungouttimeseriescomponents$figure,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))


Referensi