[R] How to include trend (drift term) in arima.sim

StephenRichards stephen at richardsconsulting.co.uk
Wed Aug 25 09:14:49 CEST 2010


Thanks to Mark Leeds and Dennis Murphy for their suggestions.  The function
arima.sim() only simulates stationary series without a trend, so the best
approach appears to be to add the simulated stationary part to the trend as
follows:

      Temp <- arima.sim(n=N.Years.Forecast, list(ar=AR.Coef, ma=MA.Coef,
intercept=Intercept), sd=SD)
      if (1 == D.) Simulated.Kappa <- Trend + cumsum(Temp)
      if (2 == D.) Simulated.Kappa <- Trend + cumsum(cumsum(Temp))

This appears to work well for d=1 in an ARIMA(p,d,q) model, but less well
for d=2, where the results appear to be unstable.  The problem is that if
the forecast starts with two or three biggish values of the differences then
these seem to take over the forecast of Kappa.
-- 
View this message in context: http://r.789695.n4.nabble.com/How-to-include-trend-drift-term-in-arima-sim-tp2331581p2337729.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list