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.Riau

datainflowkelasC$`Kep. Riau`
##  [1] 1426.343 2236.041 3377.823 2563.001 3217.655 4316.508 4411.558 5133.658
##  [9] 6077.325 6175.460 5008.786
plot(datainflowkelasC$`Kep. Riau`, type = "l", col = "red")

Visualisasi dan Prediksi Outflow di Daerah Kep.Riau

dataoutflowkelasB$`Kep. Riau`
##  [1]  5818.626  6965.628  8747.383 10122.259  9802.519 10067.635 10749.453
##  [8] 12597.089 12643.718  8461.416  5127.551
plot(dataoutflowkelasB$`Kep. Riau`, type = "l", col = "blue")

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

plot(datainflowkelasC$`Kep. Riau`, type = "l", col = "red")
lines(dataoutflowkelasB$`Kep. Riau`, 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.Riau pada Setiap Bulan

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

Time Series dan Log pada daerah Kep.Riau

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

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

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

library("TTR")
Kep.RiauSMA3 <- SMA(datainflowperbulan$`Kep. Riau` ,n=8)
plot.ts(Kep.RiauSMA3 )

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

Inflow TimeSeries
Kep.Riauinflowtimeseries <- ts(datainflowperbulan$`Kep. Riau`, frequency=12, start=c(2011,1))
Kep.Riauinflowtimeseries
##             Jan        Feb        Mar        Apr        May        Jun
## 2011   84.22317   45.28489   87.19606  106.27655   79.41735   79.39071
## 2012  154.12964  248.64100  144.87430  208.13217  195.88684  142.58026
## 2013  386.21824  264.78916  225.74983  311.08538  210.63038  202.38804
## 2014  264.22703  270.00068  175.25704  142.22593  123.06405  103.56327
## 2015  527.48615  169.98619  240.82415  193.34540  234.14488  170.06052
## 2016  661.93008  385.82752  312.32158  276.09507  316.70196  150.48089
## 2017  512.43711  385.28011  383.55697  202.89962  208.91189  105.70146
## 2018  711.86420  353.76509  374.70466  387.21015  311.02800  979.33988
## 2019  845.27320  521.35431  474.60558  353.38377  268.14443 1193.95980
## 2020  731.48682  637.43455  386.64090  524.91472  379.63698  793.99943
## 2021 1078.46297  611.51858  423.88140  540.01754  976.15802  569.57964
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  120.99479   64.58641  369.70995  126.63637  168.11264   94.51409
## 2012  206.86457  315.89649  216.54585  155.27273  155.62754   91.58926
## 2013  294.45220  919.59500  181.59798  217.10630  110.05512   54.15557
## 2014   60.20677  631.73314  222.13537  258.28860  241.39837   70.90054
## 2015  561.93669  310.80650  164.20381  281.41579  249.20775  114.23718
## 2016  809.08819  262.15868  351.87129  328.02559  261.59397  200.41305
## 2017  839.30770  414.28185  388.93568  378.94493  384.83909  206.46159
## 2018  405.77807  331.14363  383.34951  308.45259  414.23273  172.78907
## 2019  533.39994  388.53399  422.87038  421.73089  397.68404  256.38430
## 2020  507.29098  486.49911  527.42384  414.62940  516.46748  269.03594
## 2021  393.47068  415.69709
plot.ts(Kep.Riauinflowtimeseries)

Outflow TimeSeries
Kep.Riauoutflowtimeseries <- ts(dataoutflowperbulan$`Kep. Riau`, frequency=12, start=c(2011,1))
Kep.Riauoutflowtimeseries
##             Jan        Feb        Mar        Apr        May        Jun
## 2011  189.20654  268.01656  208.80011  364.35734  447.61217  516.05275
## 2012  332.54370  239.53906  479.70454  362.89160  542.67878  658.10047
## 2013  119.26413  365.97218  463.90646  372.88312  673.61694  581.56634
## 2014  517.98070  246.77804  530.04786  715.09716  830.04557  997.34576
## 2015  192.79623  628.08355  542.19874  855.97355  724.82924 1138.74670
## 2016  256.75804  506.42349  672.97048  840.07221  983.30103 1966.97714
## 2017  410.59624  367.54302  749.04887  703.31521  964.80569 2092.64435
## 2018  229.17137  850.81662  993.83877  936.80576 1739.35274 1649.76547
## 2019  351.32570  533.80541 1070.37711 1147.55958 2819.62986  249.37983
## 2020  627.16179  494.16093  823.30668  707.72583  963.88952  220.66070
## 2021  140.35818  543.53780  588.91635 1222.73228 1161.79670  437.98386
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  584.09410 1311.58555   99.21788  270.28783  510.72809 1048.66737
## 2012  660.22824 1072.58101  276.95017  630.29531  519.38376 1190.73164
## 2013 1117.71986  754.58448  735.90065  919.20095  866.05783 1776.70961
## 2014 2056.31540  207.71173  816.86614 1059.52199  601.55529 1542.99310
## 2015 1695.67523  534.01001  678.06544  545.91971  784.86345 1481.35677
## 2016  604.40807  711.35343  871.77960  638.81776  828.88407 1185.88923
## 2017  461.27959 1028.34957  764.82488  906.81927 1121.10595 1179.11994
## 2018  941.81987 1152.64514  825.48506  895.10397  878.93357 1503.35024
## 2019  971.67306 1124.34920  811.30642  969.06768 1018.72975 1576.51468
## 2020  615.39884  525.84998  521.60564  967.01965  506.01366 1488.62254
## 2021  611.98142  420.24414
plot.ts(Kep.Riauoutflowtimeseries)

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

Inflow Time Series Komponen

Kep.Riauintimeseriescomponents <- decompose(Kep.Riauinflowtimeseries)
Kep.Riauintimeseriescomponents$seasonal
##             Jan        Feb        Mar        Apr        May        Jun
## 2011  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2012  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2013  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2014  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2015  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2016  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2017  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2018  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2019  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2020  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
## 2021  230.03092   24.94082  -37.75013  -53.06279  -95.02471   79.65725
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2012  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2013  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2014  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2015  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2016  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2017  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2018  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2019  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2020  104.58593   76.67545  -16.74583  -53.76999  -58.44211 -201.09480
## 2021  104.58593   76.67545

Outflow Time Series Komponen

Kep.Riauouttimeseriescomponents <- decompose(Kep.Riauoutflowtimeseries)
Kep.Riauouttimeseriescomponents$seasonal
##             Jan        Feb        Mar        Apr        May        Jun
## 2011 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2012 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2013 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2014 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2015 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2016 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2017 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2018 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2019 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2020 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
## 2021 -503.09067 -339.62254 -122.99077  -92.95804  303.81877  225.47459
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2012  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2013  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2014  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2015  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2016  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2017  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2018  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2019  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2020  167.80534   38.30166 -166.53199  -31.68714  -54.81934  576.30014
## 2021  167.80534   38.30166

Grafik TimeSeries Kep.Riau

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

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

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

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


Referensi