ARIMA Model in R – How to Simulate Using Same Starting Values as Original Time Series?

arimar

I have built an ARIMA model in R with the "forecast" package's auto.arima() function. I want to simulate the ARIMA model with the same starting values as the original time series. For example, if my original time series has values from time 0 to time 2000, I want the ARIMA model to simulate the same time period (0 to 2000). If the ARIMA model is ARIMA(5,0,1), I want the values from time 0 to time 4 to be retained in the ARIMA model and the model simulates from that point on using those first 5 points.

I appreciate your help!

Best Answer

Try this:

library(forecast)
fit <- auto.arima(wineind)
plot(wineind)
lines(simulate(fit,future=FALSE), col='red')

enter image description here

Related Question