3
$\begingroup$

I've fitted a model with auto arima, with independent variables with the below codes:

Regressors<- cbind(GDPr_chg,r)
arima1 <-Arima(RVD_all_chg, order=c(2,0,0),seasonal=c(0,0,1), xreg=Regressors)

Turned out the model results are as below:

ARIMA(2,0,0)(0,0,1)[4] with non-zero mean
Coefficients:
        ar1      ar2     sma1  intercept  GDPr_chg        r
      1.5285  -0.5668  -0.7920     0.0990    0.4459  -0.7613
s.e.  0.0766   0.0744   0.0724     0.0274    0.1948   0.3437

I know that xreg will fit an ARIMA model for the errors, so the model should be:

y = 0.099 + 0.4459*GDPr_chg -0.7613*r + 1.5285*u(t-1) -0.5668*u(t-2)-0.7920*e(t-4) + "random error

But I couldnt obtain the same fitted values by using the above formula. Can anyone give me a hint?

Also, how does R fit the error terms for the first few forecasts when u(t-1) and u(t-2) are still not available [as u(t) should be the regression residual in time=t, right?]

Great thanks in advance everyone.

$\endgroup$
  • 1
    $\begingroup$ This will not answer your question, but still is a great resource to double-check if you got things right; it is Rob J Hyndman's blog post "The ARIMAX model muddle". $\endgroup$ – Richard Hardy Mar 10 '15 at 10:03
  • $\begingroup$ Your AR polynomial is close to being invertible you may be using a poor ARIMA identification scheme like AIC or BIC . It appears that your MA structure is redundant to your AR structure. $\endgroup$ – IrishStat Mar 10 '15 at 12:22
  • $\begingroup$ For your 2nd question about error terms, you may want to see the answer given in here. $\endgroup$ – Stat Mar 10 '15 at 12:25
  • $\begingroup$ Once I remove the Seasonal MA term, the residuals appeared to be seasonally related, cannot pass the port test... $\endgroup$ – Heywood Mar 11 '15 at 2:29
5
$\begingroup$

The autoregressive coefficients are weights for the observed series $y_t$ not for the residuals $u_t$. The correct representation of the model for the output that you show is:

\begin{eqnarray} \begin{array}{ll} \eta_t = y_t - 0.099 - 0.4459\, \hbox{GDPr_chg}_t + 0.7613 \, \hbox{r}_t \\ y_t = 0.099 + 1.5285\,(y_{t-1} - \eta_{t-1}) - 0.5668\,(y_{t-2} - \eta_{t-2}) + u_t - 0.7920\,u_{t-4} \end{array} \end{eqnarray}

As the model contains a MA part, there isn't a closed-form expression expression to obtain the fitted values. An iterative procedure is required. stats::arima uses the Kalman filter. See also the post linked by @Stat in the comments above.

For illustration of a more simple case with no MA part, you may be interested in this post and this post. The latter gives a numerical example to obtain out-of-sample forecasts in an AR model with a external regressor (which is the same as for the fitted values, observed values are replaced by forecasts).

Note: there are other definitions of the ARIMA model. The signs of the coefficients and the definition of the mean/intercept may vary depending on the software implementation you are using. This answer and related posts linked here are based on the R function stats::arima.

$\endgroup$
  • $\begingroup$ Sorry , didnt know i would cancel the question when I put a green tick there @IrishStat $\endgroup$ – Heywood Mar 11 '15 at 1:40
  • $\begingroup$ I tried the above calculation, seems the "nt" in the 1st equation is simply finding the regression residual (actual y - modelled y); but if this is ture, then in the 2nd equation, the difference of (y-n) is simply the y minus the residuals obtained in the first equation. actual y minus regression residuals = modelled y again... am i right? $\endgroup$ – Heywood Mar 11 '15 at 1:50
  • $\begingroup$ I have fixed the index in the seasonal moving-agerage, $u_{t-4}$. $\endgroup$ – javlacalle Mar 11 '15 at 8:01
  • $\begingroup$ The first equation is not the residuals of the model, it is the observed series minus the deterministic terms. In a model with no external regressors it would simply be the series $y$ minus its mean. The example in the second link that I gave may be helpful to see this. $\endgroup$ – javlacalle Mar 11 '15 at 8:05

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.