How do I simulate 10 ARIMA time series data of specified orders using R

强颜欢笑 提交于 2020-01-25 02:47:33

问题


I want to simulate 10 ARIMA time-series data that will have the following order (1,0,1), (1,1,1) and (2,2,2). such that if I test each series with auto.arima function of forecast package it will give me what I have specified.

I have tried these

set.seed(123)
n <- 10

# white noise:
wn <- ts(rnorm(n))

# initialise the first two values:
arma11 <- arma22 <- wn[1:2]

# loop through and create the 3:1000th values:
for(i in 3:n){
  arma11[i]   <- arma11[i - 1] * 0.8 + wn[i - 1] * 0.3 + wn[i] 
 arma22[i]   <- arma22[i - 1] * 0.862537 + arma22[i - 2]  * (-0.3) + 0.8 * wn[i-1] - 
0.3 * wn[i-2] + wn[i]
}

# turn them into time series, and for the last two, "integrate" them via cumulative sum

arma11 <- ts(arma11)
arima111 <- ts(cumsum(arma11))
arima222 <- ts(cumsum(cumsum(arma22)))

Test for ARIMA order

auto.arima(arma11, ic=c("bic"), approximation = F, allowdrift =F)
auto.arima(arima111, ic=c("bic"), approximation = F, allowdrift =F)
auto.arima(arima222, ic=c("bic"), approximation = F, allowdrift =F)

None of arma11 or arima111 or arima222 gives me the order I specified, can someone help me out?


回答1:


On the programming side, you can use arima.sim().

sim <- arima.sim(n=100, list(order = c(1, 0, 1), ar=0.7, ma=-0.3), sd=sqrt(0.5))

auto.arima(sim, allowmean=FALSE, allowdrift=FALSE, trace=TRUE)

You should realize that estimating an ARIMA model is not a clean process. The very first thing that stands out to me is that n=10 might be too small to estimate reliably. With trace=TRUE, you can see that how close things can be between the candidate models. auto.arima() goes through quite many steps unless you specify the parameters precisely.



来源:https://stackoverflow.com/questions/58472464/how-do-i-simulate-10-arima-time-series-data-of-specified-orders-using-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!