ARIMA(0,0,0)(0,1,4)^12 \[ y_t = y_{t-12} + a_t + \Theta_{12} a_{t-12} + \Theta_{24} a_{t-24} + \Theta_{36} a_{t-36} + \Theta_{48} a_{t-48} \]
library(forecast)
set.seed(123)
m <- 150
at <- rnorm(m, mean = 0, sd = 2)
theta12 <- -0.6
theta24 <- 0.2
theta36 <- -0.1
theta48 <- 0.05
n <- length(at)
y <- numeric(n)
for (t in 49:n) {
y[t] <- y[t-12] + at[t]+
theta12 * at[t-12] +
theta24 * at[t-24] +
theta36 * at[t-36] +
theta48 * at[t-48]
}
y <- y[-(1:50)]
ts.plot(y)
Acf(y, lag.max = 100)
Pacf(y, lag.max = 50)
# Fit model SARIMA(0,0,0)(0,1,4)[12] before differencing
fit_model <- Arima(y, order = c(0, 0, 0), seasonal = c(0, 1, 4))
summary(fit_model)
## Series: y
## ARIMA(0,0,0) with non-zero mean
##
## Coefficients:
## mean
## 0.2729
## s.e. 0.2704
##
## sigma^2 = 7.384: log likelihood = -241.36
## AIC=486.71 AICc=486.83 BIC=491.92
##
## Training set error measures:
## ME RMSE MAE MPE MAPE MASE
## Training set -3.006516e-13 2.703689 2.127399 118.5686 125.1755 0.6337136
## ACF1
## Training set -0.185077
# Uji residual
checkresiduals(fit_model)
##
## Ljung-Box test
##
## data: Residuals from ARIMA(0,0,0) with non-zero mean
## Q* = 36.529, df = 10, p-value = 6.824e-05
##
## Model df: 0. Total lags used: 10
#dilakukan differencing
y_diff <- diff(y, lag = 12)
ts.plot(y_diff)
Acf(y_diff, lag.max = 100)
Pacf(y_diff, lag.max = 100)
# Fit model SARIMA(0,0,0)(0,1,4)[12] after differencing
fit_model <- Arima(y_diff, order = c(0, 0, 0), seasonal = c(0, 1, 4))
summary(fit_model)
## Series: y_diff
## ARIMA(0,0,0) with non-zero mean
##
## Coefficients:
## mean
## -0.1664
## s.e. 0.2608
##
## sigma^2 = 6.055: log likelihood = -203.6
## AIC=411.21 AICc=411.35 BIC=416.16
##
## Training set error measures:
## ME RMSE MAE MPE MAPE MASE
## Training set -1.468775e-13 2.446694 1.954803 104.6459 104.6459 0.7084271
## ACF1
## Training set -0.09454097
# Uji residual
checkresiduals(fit_model)
##
## Ljung-Box test
##
## data: Residuals from ARIMA(0,0,0) with non-zero mean
## Q* = 5.8471, df = 10, p-value = 0.8279
##
## Model df: 0. Total lags used: 10