2
$\begingroup$

Hi all I am trying to forecast with an ARIMA model with outliers. At first

x<-ts(data$value, start=c(2009,1), end=c(2015,12),  freq=12) # keep 7 months to evaluate foecast

SAR011011<-arima(serie,order=c(0,1,1),seasonal=list(order=c(0,1,1),period=12)); 
SAR011011                        #fit.an.ARIMA.model.with.no.outlier;

Coefficients:
          ma1     sma1
      -0.3372  -0.7815
s.e.   0.1166   0.2433

sigma^2 estimated as 198465069:  log likelihood = -784.53,  aic = 1573.06

Then I check for some outliers with the TSA package

detectIO(SAR011011)

ind     19.000000 30.000000 31.000000
lambda1  5.146045 -4.250828  4.136944

So, then I added 3 outliers at theobs 19, 30 and 31

Coefficients:
          ma1     sma1      IO-19       IO-30      IO-31
      -0.1550  -0.4761  23262.107  -41275.194  20083.911
s.e.   0.1274   0.1283   8954.079    8778.279   9112.721

All of them are sigficant and really improve AIC.

So, when I tried to forecast.. most common procedures did not work.

predict(SAR011011out, n.ahead = 7, se.fit = TRUE) -->data' must be of a vector type, was 'NULL'

forecast(SAR011011out, h=3)--> 'data' must be of a vector type, was 'NULL'

I have read here that TSA does not have a predict function. But I just do not believe that is not possible to forecast incorporating outliers. what does the community use in this cases?

$\endgroup$
  • $\begingroup$ @Rob Hyndman know an approach, example or someone who can help? thanks! $\endgroup$ – Federico Armentano Nov 12 '16 at 22:45
  • $\begingroup$ I was going through my old answers and noticed this one was not accepted. Do you perhaps need further clarification? $\endgroup$ – Richard Hardy Feb 24 '17 at 14:20
1
$\begingroup$

If you have

  • a fitted ARIMA model and
  • the last few observations and residuals ($p$ observations and $q$ residuals for an ARIMA($p,q$) model; $p+P$ and $q+Q$ for SARIMA models),

there should be no difficulty in forecasting. You have all the inputs you need. Use the model formula to obtain a one-step-ahead forecast. If you want to forecast further ahead, use the forecasted value in place of the true value and iterate forward.

If you are asking how to do that in R, that would be off topic. But it is actually quite easy: if you fit your model with arima or Arima, the method predict should work. If you want to account for outliers at known time points when fitting with arima or Arima, you can use a set of dummy variables (supplied via the argument xreg) with unit values on these time points. For forecasting, you would supply zero vectors for newxreg as presumably you cannot predict the future outliers.

$\endgroup$
1
$\begingroup$

The fact that your MA(1) coefficient went from a significant -.3372 to a non-significant -.1550 suggests that your ARIMA model identification/specification was flawed thus all that followed was potentially flawed. This anachronistic view that you can assume that there are no outliers and form a model that subsequentially detects outliers suggests possible (probable )sub-optimization because your first assumption was wrong. The modern approach requires a comprehensive/simultaneous/global approach which yields a holistic model combining both memory (ARIMA) and needed dummy variables. To give you an example . First identify possible pulses/level shifts/local time trends and then take the residuals from a tentative model and then identify ARIMA . Now forma composite/hybrid model and validate/test for remaining structure in the errors which can include ARIMA modifications and additional dummy variables and possible treatment for time-varying parameters /and/or time varying/dependent error variance

IN RESPONSE TO OP'S QUESTION : The effect of future anomalies can't be predicted unless they are seasonal or part of a level shift/local time trend.... thus the expected value would be based on the non-significant ma and the significant sma parameters alone. AUTOBOX a piece of software I have helped to develop will optionally generate bootstraped forecast limits allowing for future pulses to occur. This is a unique feature of AUTOBOX.

If you want to post your actual data I will demonstrate this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.