通过预测包进行多ARIMA模拟

通过预测包进行多ARIMA模拟,r,R,我已经为我的ARIMA(1,1,1)模型做了一个10天的点预测,我还发现可以用预测包模拟未来的路径 因此,我使用以下代码来模拟未来10天的路径 yseries <- Arima(y,order=c(1,1,1)) simyseries <- simulate(yseries,nsim=10) yseriesreplicate()函数用于将命令重复n次(您需要n=10000)。它方便地存储输出 yseriesSims<-replicate(10000,simulate(yser

我已经为我的ARIMA(1,1,1)模型做了一个10天的点预测,我还发现可以用预测包模拟未来的路径

因此,我使用以下代码来模拟未来10天的路径

yseries <- Arima(y,order=c(1,1,1))
simyseries <- simulate(yseries,nsim=10)
yseriesreplicate()
函数用于将命令重复n次(您需要n=10000)。它方便地存储输出

yseriesSims<-replicate(10000,simulate(yseries,nsim=10))
yseriesSims使用
replicate()
,然后,
matplot()
进行多重绘图

y <- ts(arima.sim(model=list(order = c(1,1,1), ar=.8,ma=.7), 100)) # Simulate data
yseries <- Arima(y,order=c(1,1,1))
simyseries <- ts(replicate(10, simulate(yseries, nsim=10)),start=end(y)+1) # Change the first parameter of replicate() to change the number os simulated paths
matplot(cbind(y,simyseries), type='l')
y