Skip to main content
2 of 4
added 671 characters in body
user135784
  • 286
  • 1
  • 3
  • 11

Difference between the forecast and simulate functions in the {forecast} package in R

I have been using the forecast package in R to make forecasts based on an ARIMA model and have noticed a difference in the output of the forecast and simulate functions when calculating confidence intervals.

For example the 95% quantile calculated by the forecast function is about 0.5% higher than that based on 10000 applications of the simulate() function. Also the mean of the simulated values and the point forecasts provided by the forecast functions are slightly different.

Which one of the functions will do the job better? Or are the differences too small to worry about? (The only reason I decided to try simulate was so that a distribution could be fitted to the simulated data).

Edit: data is domestic passenger data (Jan 2003 - May 2014) from: http://www.transtats.bts.gov/Data_Elements.aspx?Data=1

library(forecast)
dm1 = arima(DAP, order = c(1,1,0), method = "ML", seasonal = list(order = c(0,1,1)))   
n.mnths = 7
    n.sim = 10000
    domesticsimulator = function(i){
      simulate(dm1, nsim = n.mnths)
    }

sim.d <- sapply(1:n.sim, function(x)domesticsimulator(x))
distr.d.mat<-t(sim.d); distr.d.mat
distr.d<-data.frame(Jun = distr.d.mat[,1],Jul = distr.d.mat[,2], Aug = distr.d.mat[,3], Sep = distr.d.mat[,4], Oct = distr.d.mat[,5], Nov = distr.d.mat[,6], Dec = distr.d.mat[,7]); distr.d

forecast(dm1)
user135784
  • 286
  • 1
  • 3
  • 11