# [R-SIG-Finance] ARIMA,GARCH and differences

Hannu Kahra hkahra at gmail.com
Mon Apr 13 08:49:37 CEST 2009

```If you have a look at the arma and arima outputs, the first one has an
intercept but in arima it is ignored:

R help for arima:
include.mean Should the ARMA model include a mean/intercept term? The
default is TRUE for undifferenced series, and it is ignored for ARIMA
models with differencing.
Further, if include.mean is true (the default for an ARMA model), this
formula applies to X - m rather than X. For ARIMA models with
differencing, the differenced series follows a zero-mean ARMA model.

> >From what I know a MA(q) model is always stationary since the MA-terms are white noise error terms.

It is true that an MA(q) model is always stationary. But in MA(q)
models a similar concept, invertibility, is required.

For example, for MA(1) r(t) = c + a(t) - theta*a(t-1) it is required
that abs(theta) < 0. Such an MA(1) model is said to be invertible.

-Hannu

On Sun, Apr 12, 2009 at 10:29 PM, Adams, Zeno <Zeno.Adams at ebs.edu> wrote:
> I do not know why both models do not produce the same result. I think they should. It may have to do with the fact that the arma function is estimated from the tseries package whereas the arima model is estimated with the help of the ts package.
>
> Yes, I forgot a log in my formula, sorry for that. See the following example for the correct code:
>
>
> set.seed(123)
> x <- 1:50 + 0.5*rnorm(50)  ; x
> dlx = diff(log(x)) ; dlx
>
> transform <- numeric(50)
> transform <- x
> for (i in 1:49) {
> transform[i+1] <- exp(dlx[i] + log(transform[i]))
> }
> transform
>
> if you dont have the price series, you can use x_0 = 100 if e.g. the price series is an index. Otherwise you need the price series.
>
> >From what I know a MA(q) model is always stationary since the MA-terms are white noise error terms.
>
> Lets see if we get a more satisfying answer from someone else from this list.
>
>
>
> -----Original Message-----
> From: r-sig-finance-bounces at stat.math.ethz.ch on behalf of babel at centrum.sk
> Sent: Sun 4/12/2009 8:01 PM
> To: r-sig-finance at stat.math.ethz.ch
> Subject: Re: [R-SIG-Finance] ARIMA,GARCH and differences
>
> Thank you for your reply, you are right with that logaritmisation, I fully agree, but the problem is this.  The I in ARIMA makes differences for you. It is obvious from the output, because the AR coefficients are very similar in the case, when I use the non stationary price series and ARMA(5,1,0) and when I use return series (lets say stationary) and model ARMA(5,0) , but NOT THE SAME. Please take o look to the following output:
>
>
> Call:
> armaFit(formula = ~arma(5, 0), data = ret)
> Model:
>  ARIMA(5,0,0) with method: CSS-ML
>
> Coefficient(s):
>      ar1           ar2               ar3               ar4              ar5            intercept
>  0.067939   0.155447   0.067962   0.026540   0.070215   0.000086
> log likelihood:       5399.57
> AIC Criterion:        -10785.14
>
> Call:
>  armaFit(formula = ~arima(5, 1, 0), data = x)
>
> Model:
>  ARIMA(5,1,0) with method: CSS-ML
>
> Coefficient(s):
>    ar1          ar2            ar3           ar4          ar5
> 0.07284  0.15856  0.07088  0.03291  0.07734
> log likelihood:       5168.35
> AIC Criterion:        -10324.71
>
>
>
> To the second answer. If the I in ARIMA just tells you how many times you need to difference, why the function armaFit makes these differenciation for you? And if it does, why it cannot be included in garchFit function in the same way? Or maybe one strange idea came to my head, what about making the ARMA model on data to get residuals, then make another ARMA model on these residuals, make 2 forecasting - forecasting of series and forecasting of errors from ARMA model and then just add these 2 results together?
>
> I believe there is a mistake in your formula. I try it on a few data, which I diff(log) and then try to transformed it back, but it didnt work. Results was totally different. I use this formula instead, which works perfectly for me, but maybe the problem is on my side :))) :
>
> for (t in 1:n-1)
> x[t+1]]<-exp(ret[t]+ log(x[t]))
>
> But for the prediction, I dont have the original price time series (xt) so how can I make the reverse transformation for that particular period? I mean in the case of ex-ante predictions, with the ex-post, it is OK.
>
> And the last thing, we have learnt that only AR part needs to be stationary. So the coefficients of ARMA model for example (0,2) can be estimated on non-stationary time series.
>
>                                   Jan Babel
>
>
> ______________________________________________________________
>> Komu: <babel at centrum.sk>, "R-SIG-Finance" <r-sig-finance at stat.math.ethz.ch>
>> Datum: 12.04.2009 15:33
>> Predmet: RE: [R-SIG-Finance] ARIMA,GARCH and differences
>>
>>Taking logs is not a linear transformation. Generally, values that have
> been very large or very small before the transformation become more
> similar after the transformation. The difference of the logs therefore
> tends to be smaller than the simple difference. The simple difference
> furthermore is not a percentage but an absolute difference so that scaling
> matters. From what I know, most people would want to take ret and not ret1
> since ret can be directly interpreted as continuous returns.
>>
>>For your second question: From what I know, in an ARIMA model the
> coefficients are not estimated on the nonstationary series but always on
> the stationary series so that the I in ARIMA just tells you how many times
> you had to differences the series to estimate the ARMA model. I dont know
> if I understand you correctly but the reverse transformation is easy to
> do: After estimating the model on the stationary returns (ret) you
> generate the forecast of the returns and then transform this back to
> prices using
>>
>>x_t = exp[ret_t + x_t-1]
>>
>>where x_0 is the is the beginning of your price series. I use a loop for
> the transformation although there is probably a more elegant vector
> function for that.
>>
>>
>>-----Original Message-----
>>From: r-sig-finance-bounces at stat.math.ethz.ch on behalf of
> babel at centrum.sk
>>Sent: Sun 4/12/2009 12:46 AM
>>To: R-SIG-Finance
>>Subject: [R-SIG-Finance] ARIMA,GARCH and differences
>>
>>Dear friends
>>
>>This is maybe trivial question for you, but why I get different results
> when I use return series and the original price series with 1.differences
> speciefied in ARIMA model? For example
>>x<-priceSeries
>>ret<-diff(log(x))
>>ret1<-diff(x)
>>
>>fit_arma = armaFit(~ arma(5,0), data = ret)
>>fit_arma1 = armaFit(~ arma(5,0), data = ret1)
>>fit_arima = armaFit(~ arima(5,1,0), data = x)
>>
>>The first model has the smallest AIC. AR parameters are very similar but
> not the same.
>>
>>The second question is more critical for me. Is there any possibility to
> enlarge  the package fGarch for the joint estiamtion of ARIMA+GARCH?
> Because in mean equation you can specifie only AR, MA, or ARMA model, not
> ARIMA. This extension I consider very important, because using the
> differences biult-in model,( I mean ARIMA) simplify the entire fitting and
> forecasting proces. If you use ARIMA, you dont need to make reverse
> transformation (from return to price series - from diff(log) to original
> scale). For evauation part it is not a big problem but for prediction part
> I find it difficult, therefore, I will prefer to use ARIMA so the garchFit
> function would produce the prediction and make the reverse transformation
> for me. (like the armaFit does)
>>
>>Thank you very much for any suggestion you provide
>>
>>_______________________________________________
>>R-SIG-Finance at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>-- Subscriber-posting only.
>>-- If you want to post, subscribe first.
>>
>>
>>
>>EBS European Business School gemeinnuetzige GmbH - Sitz der Gesellschaft:
> Geschaeftsfuehrer: Prof. Dr. Christopher Jahns,  Rektor/CEO; Dr. Reimar
> Palte,  Kanzler/CFO;  Sabine Fuchs, CMO; Verwaltungsrat: Dr. Hellmut K.
> Albrecht, Vorsitzender
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
>
>
> EBS European Business School gemeinnuetzige GmbH - Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 19951 - Umsatzsteuer-ID DE 113891213 Geschaeftsfuehrer: Prof. Dr. Christopher Jahns,  Rektor/CEO; Dr. Reimar Palte,  Kanzler/CFO;  Sabine Fuchs, CMO; Verwaltungsrat: Dr. Hellmut K. Albrecht, Vorsitzender
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

```