Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently working on ARMA+GARCH model using R. I am looking out for example which explain step by step explanation for fitting this model in R. I have time series which is stationary and I am trying to predict n period ahead value.

I have worked on this model but I am looking out for example where auto.arima() function is used for selecting best ARMA(p,q) based on AIC value.

share|improve this question
    
I am not sure you will find a detailed example. Do you know the R package fgarch ? The garchFit() function might be useful for your task at hand cran.r-project.org/web/packages/fGarch/fGarch.pdf – edouard Jan 8 '13 at 18:00
    
the link here has auto.arima() doumentation cran.r-project.org/web/packages/forecast/forecast.pdf – ash Jan 8 '13 at 18:25
    
In practice, it is often easier to just make the AR part of the ARMA long enough so that it encapsulates however much MA the series is. This way you can just use normal regression methods instead of relying on numerical methods for ARMA. – John Jan 8 '13 at 19:00

I don't know how to select ARMA lag length when doing ARMA-GARCH. Perhaps someone can edit it into this answer.


For the univariate case you want rugarch package. If you're doing multivariate stuff you want rmgarch. The reason these are better than other packages is threefold; (i) Support for exogenous variables which I haven't seen in any other package, (ii) support for dynamic conditional correlations, (iii) support for a huge multitude of fGARCH variants.

install.packages("rugarch")
require(rugarch)

Let's construct the data to be used as an example. Using $N(0,1)$ will give strange results when you try to use GARCH over it but it's just an example.

data <- rnorm(1000)

We can then compute the ARMA(1,1)-GARCH(1,1) model as an example:

spec <- ugarchspec(variance.model = list(model = "sGARCH", 
                                         garchOrder = c(1, 1), 
                                         submodel = NULL, 
                                         external.regressors = NULL, 
                                         variance.targeting = FALSE), 

                   mean.model     = list(armaOrder = c(1, 1), 
                                         external.regressors = NULL, 
                                         distribution.model = "norm", 
                                         start.pars = list(), 
                                         fixed.pars = list()))

garch <- ugarchfit(spec = spec, data = data, solver.control = list(trace=0))

Retrieve ARMA(1,1) and GARCH(1,1) coefficients:

garch@fit$coef

Retrieve time-varying standard deviation:

garch@fit$sigma

Retrieve standardized $N(0,1)$ ARMA(1,1) disturbances:

garch@fit$z

See what else you can pull out of the fit:

str(garch)
share|improve this answer

If you wander about the theoretical result of fitting parameters, the book GARCH Models, Structure, Statistical Inference and Financial Applications of FRANCQ and ZAKOIAN provides a step-by-step explanation. I think that it is not a big problem to implement these steps to R.

share|improve this answer

Here is a example of fitting Garch on financial time series. Application for regime switching in trading.

http://systematicinvestor.wordpress.com/2012/01/06/trading-using-garch-volatility-forecast/

share|improve this answer

This should walk you through what you are looking for:

https://www.quantstart.com/articles/Generalised-Autoregressive-Conditional-Heteroskedasticity-GARCH-p-q-Models-for-Time-Series-Analysis

https://www.quantstart.com/articles/ARIMA-GARCH-Trading-Strategy-on-the-SP500-Stock-Market-Index-Using-R

share|improve this answer
    
Hi Chris J, welcome to Quant.SE! Could you please edit your answer so it stands on its own? These links on their own, while useful, do not make a good answer. – Bob Jansen Apr 13 at 17:59
    
Sorry for trying to help, will never happen again. – cJc Apr 14 at 6:41
    
I do appreciate that and I believe we need to think about the future. What if these pages go away? – Bob Jansen Apr 14 at 7:53
    
I saw the question in your weekly newsletter and I instantly knew the links could help solve the problem. I can't leave a comment caus I don't have enough points or whatever. I'm sure the links will be very helpful for whoever looks this up in the future. I'm more focused on the end result than the nomenclature. I'm a trader that can code, not the other way around. – cJc Apr 14 at 9:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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