user6518665
user6518665

Reputation: 1

Generation of ARIMA.sim

I have generated an ARIMA Model for data I have and need to simulate the model generated into the future by 10 years (approximately 3652 days as the data is daily). This was the best fit model for the data generated by auto.arima, my question is how to simulate it into the future?

mydata.arima505 <- arima(d.y, order=c(5,0,5))

Upvotes: 0

Views: 1221

Answers (2)

Rob Hyndman
Rob Hyndman

Reputation: 31800

The forecast package has the simulate.Arima() function which does what you want. But first, use the Arima() function rather than the arima() function to fit your model:

library(forecast)
mydata.arima505 <- arima(d.y, order=c(5,0,5))
future_y <- simulate(mydata.arima505, 100)

That will simulate 100 future observations conditional on the past observations using the fitted model.

Upvotes: 2

Alex
Alex

Reputation: 4995

If your question is to simulate an specific arima process you can use the function arima.sim(). But I am not sure if that really is what you want. Usually you would use your model for predictions.

library(forecast)
# True Data Generating Process
y <- arima.sim(model=list(ar=0.4, ma = 0.5, order =c(1,0,1)), n=100)

#Fit an Model arima model
fit <- auto.arima(y)

#Use the estimaes for a simulation 
arima.sim(list(ar = fit$coef["ar1"], ma = fit$coef["ma1"]), n = 50)

#Use the model to make predictions
prediced values <- predict(fit, n.ahead = 50)

Upvotes: 1

Related Questions