Description Usage Arguments Value Author(s) Examples
The function get two object from 'Arima' class and 'garch' class, and then calculate to return forecasting answer of mean and variance of next day.
1 | forecastGARCH(fitARMA, fitGARCH, r = 3, trace = FALSE, newxreg = NULL)
|
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). (See |
trace |
Logical. Trace optimizer output? |
newxreg |
A covariates value of next day for ARMAX-GARCH mdels. |
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. |
Mai Thi Hong Diem <maidiemks@gmail.com>
Hong Viet Minh <hongvietminh@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #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)
|
Loading required package: MASS
Loading required package: TSA
Loading required package: leaps
Loading required package: locfit
locfit 1.5-9.1 2013-03-22
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-20. For overview type 'help("mgcv-package")'.
Loading required package: tseries
Attaching package: 'TSA'
The following objects are masked from 'package:stats':
acf, arima
The following object is masked from 'package:utils':
tar
Loading required package: TTR
Loading required package: urca
Attaching package: 'AnalyzeTS'
The following object is masked from 'package:base':
pmax
Warning message:
In garch(res1, order = c(2, 1), trace = 0) : singular information
$ARCH
a0 a1 b1 b2
5.611386e-06 1.040922e-01 3.563008e-01 5.149067e-01
$ARMA
ar1 ar2 ar3 ar4 intercept
0.0272990026 -0.0457375274 0.0004176592 -0.0339577069 0.0005090870
$forecast
Point res res^2 SSL.forecast VAR.forecast
1 (1110,4) 8.5e-05
2 (1110,5) -0.001767 3.123187 7.8e-05
3 (1111,1) 0.000458 7.756531
Point SSL.forecast VAR.forecast
(1111,1) 0.000458 7.756531
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.