2013-03-20 59 views
0

我已經對ARIMA(1,1,1)模型做了10天的天氣預報,並且我還發現可以使用預測包模擬未來路徑。通過預測包進行多重ARIMA模擬

因此,我使用下面的代碼來模擬10天的未來路徑。

yseries <- Arima(y,order=c(1,1,1)) 
simyseries <- simulate(yseries,nsim=10) 

有沒有一種方法來模擬,比如說10 000與simulate()功能未來的路徑?

我的最終目標是繪製我的點預測和模擬路徑。

如果預測軟件包不可能,那麼有沒有其他的軟件包可以讓我做到這一點?

回答

0

使用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') 
0

replicate()功能是用於重複的命令Ñ倍(你需要Ñ = 10000)是有用的。它可以方便地存儲輸出。

yseriesSims<-replicate(10000,simulate(yseries,nsim=10)) 

結果是在這種情況下10×10000的模擬矩陣(即列包含單獨的模擬)。