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

UIN Maulana Malik Ibrahim Malang - Teknik Informatika

Data Beberapa Wilayah di Sumatera

Data Inflow

library(readxl)
## Warning: package 'readxl' was built under R version 4.1.2
datainflowkelasC <- read_excel(path = "C:/Users/ASUS PC/Documents/BUKU NOVA/RStudio/RMarkdown/kelascup.xlsx")
dataoutflowkelasB <- read_excel(path = "C:/Users/ASUS PC/Documents/BUKU NOVA/RStudio/RMarkdown/kelasout.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
## # 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 Jambi

datainflowkelasC$Jambi
##  [1] 1867.621 2138.463 3046.784 5169.097 4978.134 4398.161 4403.638 5656.590
##  [9] 6486.166 5628.402 4979.747
plot(datainflowkelasC$Jambi, type = "l", col = "red")

Visualisasi dan Prediksi Outflow di Daerah Jambi

dataoutflowkelasB$Jambi
##  [1] 5216.694 5013.235 6302.359 8361.178 8324.512 7773.966 8433.893 8459.397
##  [9] 9204.041 8949.968 6046.364
plot(dataoutflowkelasB$Jambi, type = "l", col = "blue")

Visualisasi dan Prediksi Inflow-Outflow di Daerah Jambi Setiap Periode

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

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

Time Series dan Log pada Daerah Jambi

Jambitimeseries <- datainflowperbulan$Jambi
plot.ts(Jambitimeseries , type = "l", col = "green")

logJambi <- log(datainflowperbulan$Jambi)
plot.ts(logJambi)

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

library("TTR")
JambiSMA3 <- SMA(datainflowperbulan$Jambi ,n=8)
plot.ts(JambiSMA3 )

Visualisasi Prediksi Data Inflow-Outflow Time Series Uang Kartal di Daerah Jambi

Inflow TimeSeries
Jambiinflowtimeseries <- ts(datainflowperbulan$Jambi, frequency=12, start=c(2011,1))
Jambiinflowtimeseries
##             Jan        Feb        Mar        Apr        May        Jun
## 2011   48.21238   39.91336  202.77581   76.36759  102.29337   80.38363
## 2012  214.78357  185.06614  118.25569  112.18712  176.73267  131.65442
## 2013  440.25724  250.16557  156.40296  131.70444   80.43460   90.88444
## 2014  648.84622  443.17728  218.60749  372.98546  277.49781  326.07002
## 2015  800.91577  310.67803  334.27000  339.99797  285.21811  266.80514
## 2016  723.86727  399.44327  227.89071  207.32596  294.89205  265.25147
## 2017  436.71704  349.18620  374.44420  291.87853  265.93193  109.35945
## 2018  850.92308  423.79251  432.57396  284.21732  331.44473  943.33760
## 2019  928.32921  508.44605  501.71263  395.87576  375.81227 1377.08370
## 2020  929.25223  453.21208  375.57835  488.00832  366.02264  926.36280
## 2021 1319.31010  533.89020  481.47669  442.30053  954.47189  568.16022
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  118.45074   91.88117  618.33464  137.23519  238.83742  112.93547
## 2012  178.67562  446.70847  180.60249   96.89252  190.29249  106.61224
## 2013  150.73569  696.17818  239.01380  381.11280  240.84581  189.04884
## 2014  228.38825 1336.65537  383.31015  366.82210  328.60113  238.13597
## 2015 1033.05014  473.13670  295.54859  329.75416  266.79923  241.96031
## 2016 1069.41796  211.81993  325.26906  251.99989  234.81316  186.17002
## 2017 1008.96424  331.35488  369.25742  288.45059  300.80490  277.28824
## 2018  555.66909  452.09732  390.12811  409.82051  356.98477  225.60052
## 2019  517.64046  582.60662  370.00861  477.26284  302.21112  149.17703
## 2020  418.88012  362.62433  363.94528  290.43227  404.08403  249.99980
## 2021  337.72947  342.40788
plot.ts(Jambiinflowtimeseries)

Outflow TimeSeries
Jambioutflowtimeseries <- ts(dataoutflowperbulan$Jambi, frequency=12, start=c(2011,1))
Jambioutflowtimeseries
##             Jan        Feb        Mar        Apr        May        Jun
## 2011  297.46348  280.08970  341.37188  474.26014  371.36905  540.43609
## 2012  133.61579  321.29557  315.41057  373.26078  441.58952  474.63459
## 2013  110.31731  184.50535  223.54744  235.42017  450.54670  349.51626
## 2014  351.35683  459.63127  637.62828  526.41165  683.34064  651.89272
## 2015  249.99472  486.10988  549.06994  721.86428  701.16932  931.14718
## 2016  229.69662  442.46621  487.32817  572.51965  587.13872 1610.89703
## 2017  394.17886  553.63581  500.03923  530.31764  570.86673 1961.91565
## 2018  275.03184  451.87980  498.71186  687.34280 1222.83919 1579.32715
## 2019  218.20233  534.52562  559.51510  895.65817 2018.12386  147.10847
## 2020  230.43948  421.99569  606.04929  713.68012 1262.75583  143.79548
## 2021   54.41456  487.87292  732.48101 1261.14201 1578.66374  642.31328
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  428.10203 1056.05643   92.78528  295.39728  272.21261  767.15036
## 2012  330.20592  835.74847  221.85612  472.49384  299.07579  794.04754
## 2013  839.48154  339.88048  732.69193  819.24007  782.02490 1235.18658
## 2014 1929.38736  274.46904  553.86575  703.65271  588.68032 1000.86095
## 2015 1582.71912  395.76377  549.45261  479.75684  631.21748 1046.24662
## 2016  456.38157  430.25770  842.64910  521.69293  648.58138  944.35648
## 2017  212.49734  680.41258  470.55865  568.53590  820.95090 1169.98413
## 2018  391.43773  555.29629  475.32140  545.11918  735.03562 1042.05433
## 2019  717.81375  656.73797  617.28665  719.15618  727.75492 1392.15834
## 2020  633.64958  610.36918  689.06184 1124.09728  807.10093 1706.97368
## 2021  664.55917  624.91746
plot.ts(Jambioutflowtimeseries)

Visualisasi Prediksi Data Inflow-Outflow Time Series Komponen Uang Kartal di Daerah Jambi

Inflow Time Series Komponen

Jambiintimeseriescomponents <- decompose(Jambiinflowtimeseries)
Jambiintimeseriescomponents$seasonal
##             Jan        Feb        Mar        Apr        May        Jun
## 2011  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2012  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2013  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2014  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2015  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2016  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2017  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2018  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2019  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2020  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
## 2021  331.44588  -14.12609  -81.49621  -93.86719 -114.25191  104.66208
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2012  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2013  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2014  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2015  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2016  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2017  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2018  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2019  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2020  156.97755  120.14214  -28.04183  -81.29134 -102.91768 -197.23539
## 2021  156.97755  120.14214

Outflow Time Series Komponen

Jambiouttimeseriescomponents <- decompose(Jambioutflowtimeseries)
Jambiouttimeseriescomponents$seasonal
##             Jan        Feb        Mar        Apr        May        Jun
## 2011 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2012 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2013 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2014 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2015 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2016 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2017 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2018 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2019 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2020 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
## 2021 -429.76166 -219.28351 -144.71768  -53.62864  238.04681  221.42655
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2011  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2012  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2013  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2014  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2015  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2016  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2017  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2018  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2019  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2020  120.11152  -48.40994 -109.85159  -14.39860  -16.35840  456.82513
## 2021  120.11152  -48.40994

Grafik TimeSeries Jambi

plot(Jambiintimeseriescomponents$seasonal,type = "l", col = "red")
lines(Jambiouttimeseriescomponents$seasonal,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

plot(Jambiintimeseriescomponents$trend,type = "l", col = "red")
lines(Jambiouttimeseriescomponents$trend, col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

plot(Jambiintimeseriescomponents$random ,type = "l", col = "red")
lines(Jambiouttimeseriescomponents$random,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))

plot(Jambiintimeseriescomponents$figure ,type = "l", col = "red")
lines(Jambiouttimeseriescomponents$figure,col="blue")
legend("top",c("Inflow","Outflow"),fill=c("red","blue"))


Referensi