Pada tugas Business Intelligence kali ini, saya menyediakan simulasi model AR(2)
#Simulasi AR(2) dengan koefisien (0.32;0.46)
set.seed(123)
x10 <- arima.sim(model = list(ar = c(0.32, 0.46)), n = 1000, innov=rnorm(1000))
plot.ts(x10)
acf(x10, lag.max=18)
arma10 <- arima(x10, order = c(2, 0, 0), include.mean = FALSE) # uses ARIMA(p,d,q) specificatio
arma10
##
## Call:
## arima(x = x10, order = c(2, 0, 0), include.mean = FALSE)
##
## Coefficients:
## ar1 ar2
## 0.2948 0.4593
## s.e. 0.0281 0.0281
##
## sigma^2 estimated as 1.008: log likelihood = -1423.58, aic = 2853.16
coeftest(arma10)
##
## z test of coefficients:
##
## Estimate Std. Error z value Pr(>|z|)
## ar1 0.294789 0.028064 10.504 < 2.2e-16 ***
## ar2 0.459333 0.028110 16.341 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ac(arma10$residuals)
checkresiduals(arma10)
##
## Ljung-Box test
##
## data: Residuals from ARIMA(2,0,0) with zero mean
## Q* = 3.6023, df = 8, p-value = 0.8911
##
## Model df: 2. Total lags used: 10