Learn R Programming

AnalyzeTS (version 2.0)

forecastGARCH: Forecast GARCH Model

Description

This function get two object from 'Arima' class and 'garch' class, and then calculate to return forecasting answer of mean and variance of next day.

Usage

forecastGARCH(fitARMA, fitGARCH, r = 3, trace = FALSE, newxreg = NULL)

Arguments

fitARMA
A object from 'Arima' class.
fitGARCH
A object from 'garch' class.
r
Rounds the answer to the specified number of decimal places (default 3).
trace
Logical. Trace optimizer output?
newxreg
A covariates value of next day for ARMAX-GARCH mdels.

Value

ARCH
GARCH coefficients.
ARMA
ARMA coefficients.
forecast
Forecasting answer:Point: forecasting time.res: forecasting residual.res^2: res square.SSL.forecast: forecating mean value.VAR.forecast: forecasting variance value.

Examples

Run this code
#Load data
library(TTR)
data(ttrc)

#Calculate SSL series
t<-ts(ttrc[,"Close"],start=1,frequency=5)
ln.t<-log(t)
r<-diff(ln.t)

#Find a ARIMA model
fit1<-arima(r,order=c(4,0,0))

#Find a GARCH model
res1<-resid(fit1)
library(tseries)
fit2<-garch(res1,order=c(2,1),trace=0)

#Forecasting
forecastGARCH(fit1,fit2,r=6,trace=TRUE)
forecastGARCH(fit1,fit2,r=6)

Run the code above in your browser using DataLab