I have a question regarding the "rugarch" package in R. I try to fit a ARMA(1,1)+GARCH(1,1) to a time series $x$ using the following command:

spec <- ugarchspec(variance.model=list(model="sGARCH", garchOrder=c(1,1)), mean.model=list(c(1,1)))
fitted <- ugarchfit(spec, x)

The code above gives me the following result:

Optimal Parameters


        Estimate  Std. Error   t value Pr(>|t|)
mu      0.001001    0.001315  0.761040 0.446633
ar1     0.008470    0.351193  0.024118 0.980759
ma1     0.119446    0.345840  0.345379 0.729809
omega   0.000025    0.000016  1.571823 0.115992
alpha1  0.127315    0.053834  2.364961 0.018032
beta1   0.814652    0.069936 11.648563 0.000000`

Now my question is the following, how are the residuals calculated? The one you obtain from the command residuals(fitted)?

I mean for me I would assume that for instance, if $r_t$ is residual at time $t$:

$r_t = x_t - \mu - AR_1x_{t-1} - MA_1r_{t-1}$

But already for their first residuals, how do you obtain it? Here are my values of $x$ :
$x_1 = 0.009888849$
$x_2 = -0.008468736$
and the residuals from command residuals(fitted):

Using my method I get:
$r_1 = x_1 -\mu = 0.007927641 \neq r_1$
$r_2 = x_1 - \mu - AR_1 x_1 - MA_1 r_1 = -0.01099179$
and so on. Basically it is not far, but it is also not what they have, so I would like to know if someone could tell me what I am missing here?


  • 1
    $\begingroup$ Example: zero-mean ARMA(1,1)+GARCH(1,1): $$x_t=\phi_1 x_{t-1}+\varepsilon_t+\theta_1 \varepsilon_{t-1}$$ where $$\varepsilon_t=\sigma_t u_t$$ and $\sigma_t$ is described as a GARCH process while $u_t$ is i.i.d. random variable. The residuals given by residuals(fitted) will be the $\varepsilon_t$'s. $\endgroup$ Apr 29, 2015 at 8:11
  • $\begingroup$ Hello Richard, thank you for your answer. But then my question is, what are the starting values to start the recurence? $\endgroup$ Apr 29, 2015 at 8:21
  • $\begingroup$ Do you mean $\varepsilon_t$ for $t<1$? That should be noted somewhere in the documentation. But that is a different question. If you want to obtain the residuals just for $t \geqslant 1$, you do not need that. $\endgroup$ Apr 29, 2015 at 8:30

1 Answer 1


I can see that you have made errors in your calculation (that you haven't shown). Please recalculate properly and you'll see that the answers are exactly matching.

For e.g. r1 = x1 −μ = 0.009888849-0.001001 = 0.008887,

which is equal to r1 that you get with the residuals functions. Secondly, in your formula of r2, the first term should be x2 instead of x1, and I believe it's a typo.

Also, note that you can obtain the optimal parameter values with higher number of significant figures using the coef(fitted) function, which will be useful in your calculation.

  • 1
    $\begingroup$ Could you expand your answer to demonstrate how OP has made in the calculations? Walking through the mechanics will make it clear to everyone how and where OP when wrong, as well as showing OP how to do it correctly in the future. $\endgroup$
    – Sycorax
    Nov 16, 2015 at 21:30
  • $\begingroup$ @user777 Expanded. However, in the future, I would suggest OP to include detailed calculations in the post so that answerers can identify the mistake, instead of answerers redoing the entire calculation for him. $\endgroup$ Nov 17, 2015 at 8:07

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.