Search code examples
rdata-modelingfinancearimaforecast

How to use ARIMA in GARCH model


I have financial data and my goal is to be able to forecast. I ran an arima model and found that the best fit was arima(1,1,1) w/ drift. I want to use GARCH on the data set because it is the better model to use due to volatility and when I squared my residuals it did have the arch effect. But I know that GARCH takes in a 2 parameter arima and I am not sure how that translates from the 3 parameter arima I currently have.

library(dplyr)
library(tidyr)
library(lubridate)
library(ggplot2)
library(TSA)
library(forecast)
spnew<-read.csv(file="~/Desktop/SPNEW.csv", header=T, 
sep=",",check.names=FALSE)
sfts1=ts(sp$`Adj Close`, 
freq=260,start=decimal_date(ymd("2009-01-02")))
arsf1=auto.arima(sfts1, trace=T)

I have the code to run for GARCH but am not sure what to input for the arima portion.

model1 <-  ugarchspec(variance.model = list(model="sGARCH",         
                                                 garchOrder=c(_,_)), 
                           mean.model = list(armaOrder=c(_,_)), 
                           distribution.model = "norm")        
mod2 <- ugarchfit(spec=model1, 
                          data=sfts1)

I left blanks for what I would need to input. I will play with the garch order once I know how to put in arima. If a better way to code the GARCH model is known please let me know.


Solution

  • Below, I refer to the model that you call 2 parameter arima as ARMA.
    rugarch::ugarchspec() can treat ARMA(p, q) or ARFIMA(p, d, q) model as mean.model.
    (NOTE: when d is integer, ARFIMA(p, d, q) is equivalent to ARIMA(p, d, q))

    Here is my example;

    p <- 1
    q <- 1
    # d <- 1    # if you want to fix d
    
    model1 <-  ugarchspec(variance.model = list(model="sGARCH",         
                                                garchOrder=c(_, _)), 
                          mean.model = list(armaOrder=c(p, q),
                                            arfima = T),    # using arfima model
                          # fixed.pars=list(arfima = d),    # If you want to fix d
                          distribution.model = "norm"))