1
$\begingroup$

I have simulated an ARIMA(1,0,1) process using R. Below is the code.

library(stats)
library(forecast)
set.seed(101)
y <- arima.sim(n=1000,list(ar=0.2,ma=0.6))
plot(y)
qa <- arima(y,order=c(1,0,1))

Below is the output:

ARIMA(1,0,1) with non-zero mean 

Coefficients:
         ar1     ma1  intercept
      0.2022  0.5895    -0.0713
s.e.  0.0430  0.0349     0.0605

sigma^2 estimated as 0.9236:  log likelihood=-1379.57
AIC=2767.14   AICc=2767.18   BIC=2786.77

I'm trying to see if the estimated residuals matches the calculated residuals for example, an ARMA (1,0,1) residual can be written as: $$ e_{t} = y_{t} - \mu -\phi y_{t-1}+\theta e_{t-1} $$ $$ \mu = intercept $$ $$ \phi=ar1 - coefficient $$ $$ \theta = ma1 - coefficient $$

Code for calculating residuals

      n = length(y)
      e = rep(1,n)
      e[1] = 0 ##since there is no residual at 1, e1 = 0
      for (t in (2 : n)){
        e[t] = y[t] +0.0713 - 0.2022 *y[t-1] + 0.5895*e[t-1]
      }

Inputting all the numbers into equation say for residual 10

$$ e_{10} = y_{10} - (-0.0713) -0.2022y_{9} +0.5895e_{9} $$

calculated residual is:

> e[10]
[1] -0.8278073

residual from running arima in R is

> qa$residuals[10]
[1] -0.1424167

The estimated and calculated numbers don't match.

My questions are

  1. Am I doing something incorrect here ?
  2. Why is there a difference between calculated and estimated numbers?
$\endgroup$

1 Answer 1

2
$\begingroup$

Try calculating your residuals by changing the sign of the ma(1) coefficient.

$\endgroup$
1
  • $\begingroup$ @forecaster Perhaps we should communicate offline as it appears that you are keenly interested in software and time series . Please contact me at my email address. $\endgroup$
    – IrishStat
    Commented Sep 23, 2013 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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