install.packages("forecast") install.packages("tseries") install.packages("foreign") install.packages("readxl") install.packages("normwhn.test") install.packages("tsoutliers") library('ggplot2') library('forecast') library('tseries') library("foreign") library("readxl") library("tsoutliers") library("normwhn.test") #1. Persiapan Data inf<-read.csv(choose.files(),sep=";",header=TRUE) #summary statistik summary(inf) (inf) #2. Stationerity adf.test(inf$Inflasi, alternative = "stationary") Acf(inf$Inflasi, main='') Pacf(inf$Inflasi, main='') #3. Diferensiasi Inf1 = diff(inf$Inflasi, differences = 1) plot(Inf1,type="o") adf.test(Inf1, alternative = "stationary") #4 Orderlag Acf(Inf1, main='') Pacf(Inf1, main='') #5. Estimation fit_1 <- arima(inf$Inflasi, order = c(1,0,1)) fit_2 <- arima(inf$Inflasi, order = c(1,0,2)) fit_3 <- arima(inf$Inflasi, order = c(2,0,1)) fit_4 <- arima(inf$Inflasi, order = c(2,0,2)) summary(fit_1) summary(fit_2) summary(fit_3) summary(fit_4) #evaluation Model jarque.bera.test(residuals(fit_1)) jarque.bera.test(residuals(fit_2)) jarque.bera.test(residuals(fit_3)) jarque.bera.test(residuals(fit_4)) whitenoise.test(residuals(fit_1)) whitenoise.test(residuals(fit_2)) whitenoise.test(residuals(fit_3)) whitenoise.test(residuals(fit_4)) Box.test (residuals(fit_1), lag = 1, type = "Ljung") Box.test (residuals(fit_2), lag = 1, type = "Ljung") Box.test (residuals(fit_3), lag = 1, type = "Ljung") Box.test (residuals(fit_4), lag = 1, type = "Ljung") Acf(residuals(fit_1), main='') Pacf(residuals(fit_1), main='') Acf(residuals(fit_2), main='') Pacf(residuals(fit_2), main='') Acf(residuals(fit_3), main='') Pacf(residuals(fit_3), main='') Acf(residuals(fit_4), main='') Pacf(residuals(fit_4), main='') #7. Forecast fcast <- forecast(fit_4, h=12) plot(fcast) fcast fcast1<-data.frame(fcast) install.packages("writexl") library("writexl") write_xlsx(fcast1,"D:\\file name.xlsx")