library(urca)
library(timeSeries)
## Loading required package: timeDate
library(readxl)
library(tseries)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
list.files()
## [1] "~$SIL OLAH DATA STATISTIK DAN PENJELASAN.docx"
## [2] "~WRL3745.tmp"
## [3] "data_rapi.xlsx"
## [4] "grafik.png"
## [5] "HASIL OLAH DATA STATISTIK DAN PENJELASAN.docx"
## [6] "kode-Arima-untuk-publikasi-olah-data.Rmd"
## [7] "Kode-R-Arima-Fix.html"
## [8] "kode-R-arima.html"
## [9] "kode Arima lengkappp.Rmd"
## [10] "kode Arima untuk publikasi olah data.Rmd"
## [11] "Kode R Arima Fix.Rmd"
## [12] "kode R arima.nb.html"
## [13] "kode R arima.Rmd"
## [14] "OLAH DATA FIX.xlsx"
## [15] "rsconnect"
dat <- read_excel("data_rapi.xlsx")
dat <- as.data.frame(dat)
dat
susun_data <- reshape2::melt(dat, id = c("Tahun"))
wilayah <- colnames(dat)
wilayah <- wilayah[-c(1)]
susun_data[,2] = factor(susun_data[,2], levels = wilayah)
susun_data
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.2
ggplot(data = susun_data, aes(x = Tahun, y = value, group = variable, colour = variable)) +
geom_line()+
geom_point()+labs(colour="Wilayah") + ylab("Jumlah Mahasiswa")
Gambar di atas disajikan jumlah mahasiswa, dari tahun 2017 sampai tahun 2022 untuk setiap wilayah. Terlihat bahwa pada Tahun 2017, jumlah mahasiswa paling banyak berada pada luar pulau papua, yakni sebanyak 850. Terlihat bahwa pada Tahun 2018, jumlah mahasiswa paling banyak berada pada Kabupaten Manokwari, yakni sebanyak 792. Terlihat bahwa pada Tahun 2019, jumlah mahasiswa paling banyak berada pada Kabupaten Manokwari, yakni sebanyak 829. Terlihat bahwa pada Tahun 2020, jumlah mahasiswa paling banyak berada pada Kabupaten Manokwari, yakni sebanyak 640. Terlihat bahwa pada Tahun 2021, jumlah mahasiswa paling banyak berada pada Kabupaten Manokwari, yakni sebanyak 639. Terlihat bahwa pada Tahun 2022, jumlah mahasiswa paling banyak berada pada Kabupaten Manokwari, yakni sebanyak 748. Sementara pada Tahun 2018 dan Tahun 2020, tidak terdapat mahasiswa di Kabupaten Pegunungan Arfak.
#Uji Stasioner pada Level
Mahyus (2014:73) menyatakan untuk dapat menggunakan model ARMA ataupun ARIMA maka sebuah data haruslah stasioner. Apabila data tersebut stasioner pada ordo 0 (nol) atau pada “Level” maka data tersebut dapat menggunakan model ARMA. Sementara itu, apabila data stasioner pada ordo 1 (“first difference”) ataupun ordo 2 (“second difference”) maka data tersebut dapat menggunakan model ARIMA.
Selanjutnya dilakukan uji stasioner dengan pendekatan Kwiatkowski-Phillips-Schmidt-Shin (KPSS).
library(urca)
library(timeSeries)
nilai_pvalue = vector(mode = "numeric")
nama_wilayah <- vector(mode = "character")
hasil_ujistasioner <- vector(mode = "character")
k = 0
for(i in 2 : (length(dat)) )
{
x = dat[,i]
nama <- colnames(dat)[c(i)]
hasil <- kpss.test(x, null="Trend")
k = k + 1
nilai_pvalue[k] <- hasil$p.value
nama_wilayah[k] <- nama
if( nilai_pvalue[k] >= 0.05 )
{
hasil_ujistasioner[k] = paste0("Tidak Stasioner pada Level; p >= 0.05")
}
if( nilai_pvalue[k] < 0.05 )
{
hasil_ujistasioner[k] = paste0("Stasioner pada Level; p < 0.05")
}
}
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value greater than printed p-value
#hasil@cval
hasil_ujistasioner <- data.frame(nama_wilayah, nilai_pvalue, hasil_ujistasioner)
colnames(hasil_ujistasioner) = c("Wilayah", "P-Value", "Hasil Uji Stasioner")
hasil_ujistasioner
Berdasarkan hasil pengujian stasioner pada Level, terdapat beberapa wilayah, dengan hasil pengujian tidak stasioner pada level.
x = hasil_ujistasioner
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Uji Stasioner pada First Difference
Oleh karena terdapat beberapa wilayah dengan hasil pengujian data tidak stasioner pada level, maka akan dilakukan pengujian stasioner pada tahap first difference, menggunakan uji stasioner dengan pendekatan Kwiatkowski-Phillips-Schmidt-Shin (KPSS).
library(urca)
library(timeSeries)
nilai_pvalue = vector(mode = "numeric")
nama_wilayah <- vector(mode = "character")
hasil_ujistasioner <- vector(mode = "character")
k = 0
for(i in 2 : (length(dat)) )
{
x = dat[,i]
x <- diff(x)
nama <- colnames(dat)[c(i)]
hasil <- kpss.test(x, null="Trend")
k = k + 1
nilai_pvalue[k] <- hasil$p.value
nama_wilayah[k] <- nama
if( nilai_pvalue[k] >= 0.05 )
{
hasil_ujistasioner[k] = paste0("Tidak Stasioner pada First Difference; p >= 0.05")
}
if( nilai_pvalue[k] < 0.05 )
{
hasil_ujistasioner[k] = paste0("Stasioner pada First Difference; p < 0.05")
}
}
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
#hasil@cval
hasil_ujistasioner <- data.frame(nama_wilayah, nilai_pvalue, hasil_ujistasioner)
colnames(hasil_ujistasioner) = c("Wilayah", "P-Value", "Hasil Uji Stasioner")
hasil_ujistasioner
Berdasarkan pengujian stasioner pada first difference, masih terdapat beberapa wilayah, yang memberikan hasil tidak stasioner.
x = hasil_ujistasioner
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Uji Stasioner pada Second Difference
Oleh karena terdapat beberapa wilayah dengan hasil pengujian data tidak stasioner pada first difference, maka akan dilakukan pengujian stasioner pada tahap second difference, menggunakan uji stasioner dengan pendekatan Kwiatkowski-Phillips-Schmidt-Shin (KPSS).
nilai_pvalue = vector(mode = "numeric")
nama_wilayah <- vector(mode = "character")
hasil_ujistasioner <- vector(mode = "character")
k = 0
for(i in 2 : (length(dat)) )
{
x = dat[,i]
x <- diff(x)
x <- diff(x)
nama <- colnames(dat)[c(i)]
hasil <- kpss.test(x, null="Trend")
k = k + 1
nilai_pvalue[k] <- hasil$p.value
nama_wilayah[k] <- nama
if( nilai_pvalue[k] >= 0.05 )
{
hasil_ujistasioner[k] = paste0("Tidak Stasioner pada First Difference; p >= 0.05")
}
if( nilai_pvalue[k] < 0.05 )
{
hasil_ujistasioner[k] = paste0("Stasioner pada First Difference; p < 0.05")
}
}
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
## Warning in kpss.test(x, null = "Trend"): p-value smaller than printed p-value
#hasil@cval
hasil_ujistasioner <- data.frame(nama_wilayah, nilai_pvalue, hasil_ujistasioner)
colnames(hasil_ujistasioner) = c("Wilayah", "P-Value", "Hasil Uji Stasioner")
hasil_ujistasioner
Berdasarkan hasil uji stasioner pada second difference, diketahui seluruh nilai p < 0.05 untuk semua wilayah.
x = hasil_ujistasioner
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Fak-Fak
x = dat[,2]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
## Warning in log(s2): NaNs produced
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Kaimana
x = dat[,3]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
## Warning in log(s2): NaNs produced
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Manokwari
x = dat[,4]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
## Warning in log(s2): NaNs produced
## Warning in arima(x, order = c(2, 2, 1), method = "CSS-ML"): possible convergence
## problem: optim gave code = 1
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Manokwari Selatan
x = dat[,5]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Pegunungan Arfak
x = dat[,6]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Teluk Bintuni
x = dat[,7]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "ML" )
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Teluk Wondama
x = dat[,8]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Papua
x = dat[,9]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Papua Barat Daya
x = dat[,10]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
## Warning in arima(x, order = c(2, 2, 2), method = "CSS-ML"): possible convergence
## problem: optim gave code = 1
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Papua Pegunungan
x = dat[,11]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Papua Tengah
x = dat[,12]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Papua Selatan
x = dat[,13]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)
#Peramalan Luar Pulau Papua
x = dat[,14]
colnames(dat)[c(2)]
## [1] "KAB. FAK-FAK"
hasil1 <- arima(x, order = c(1,2,1), method = "CSS-ML" )
## Warning in arima(x, order = c(1, 2, 1), method = "CSS-ML"): possible convergence
## problem: optim gave code = 1
hasil2 <- arima(x, order = c(1,2,2), method = "CSS-ML" )
hasil3 <- arima(x, order = c(2,2,1), method = "CSS-ML" )
## Warning in arima(x, order = c(2, 2, 1), method = "CSS-ML"): possible convergence
## problem: optim gave code = 1
hasil4 <- arima(x, order = c(2,2,2), method = "CSS-ML" )
## Warning in arima(x, order = c(2, 2, 2), method = "CSS-ML"): possible convergence
## problem: optim gave code = 1
simpan_AIC = c(hasil1$aic, hasil2$aic, hasil3$aic, hasil4$aic)
jenis_arima = c("ARIMA(1,2,1)", "ARIMA(1,2,2)", "ARIMA(2,2,1)", "ARIMA(2,2,2)")
dframe = data.frame(jenis_arima, simpan_AIC)
colnames(dframe) = c("Model ARIMA", "AIC")
prediksi1 <- predict(hasil1, 3)
prediksi1 <- prediksi1$se
prediksi1 <- unlist(prediksi1)
prediksi1 <- round(prediksi1, digits = 0)
prediksi2 <- predict(hasil2, 3)
prediksi2 <- prediksi2$se
prediksi2 <- unlist(prediksi2)
prediksi2 <- round(prediksi2, digits = 0)
prediksi3 <- predict(hasil3, 3)
prediksi3 <- prediksi3$se
prediksi3 <- unlist(prediksi3)
prediksi3 <- round(prediksi3, digits = 0)
prediksi4 <- predict(hasil4, 3)
prediksi4 <- prediksi4$se
prediksi4 <- unlist(prediksi4)
prediksi4 <- round(prediksi4, digits = 0)
prediksi = rbind(prediksi1, prediksi2, prediksi3, prediksi4)
rownames(prediksi) = NULL
colnames(prediksi) = c("2023", "2024", "2025")
dframe = data.frame(dframe, prediksi)
colnames(dframe) = c("Model ARIMA", "Akaike Info Criterion(AIC)", "Peramalan 2023", "Peramalan 2024", "Peramalan 2025")
dframe
x = dframe
wb <- openxlsx::createWorkbook()
hs1 <- openxlsx::createStyle(fgFill = "#DCE6F1", halign = "CENTER", textDecoration = "italic",
border = "Bottom")
hs2 <- openxlsx::createStyle(fontColour = "#ffffff", fgFill = "#4F80BD",
halign = "center", valign = "center", textDecoration = "bold",
border = "TopBottomLeftRight")
openxlsx::addWorksheet(wb, "", gridLines = TRUE)
openxlsx::writeDataTable(wb, "", x, rowNames = FALSE, startRow = 2, startCol = 2, tableStyle = "TableStyleMedium21")
openxlsx::openXL(wb)