Monday, November 21, 2016

time series - GARCH model and prediction


I have a question about the prediction of volatility and returns of a time series. Basically it is a question about predict in the fGarchpackage.



The following code is from the book Analysis of financial time series and it is an example of AR/GARCH models for the log returns of the SP500


library(fGarch)
sp5=read.table("http://faculty.chicagobooth.edu/ruey.tsay/teaching/fts/sp500.dat")#Load data
plot(sp5,type="l")
m1=garchFit(formula=~arma(3,0)+garch(1,1),data=sp5,trace=F)
summary(m1)
m2=garchFit(formula=~garch(1,1),data=sp5,trace=F,cond.dist="std")
summary(m2)
stresi=residuals(m2,standardize=T)
plot(stresi,type="l")

Box.test(stresi,10,type="Ljung")
predict(m2,5)

First we assume an ARMA/GARCH model. However, we see that all the coefficient from the AR model are not significant. Hence we model a pure GARCH time series. My question is about the very last command. Running this command gives the following output:


    > predict(m2,5)
meanForecast meanError standardDeviation
1 0.008455044 0.05330089 0.05330089
2 0.008455044 0.05327886 0.05327886
3 0.008455044 0.05325781 0.05325781
4 0.008455044 0.05323769 0.05323769

5 0.008455044 0.05321847 0.05321847

What is here the meanForecast and why is it always the same number? Is there a way to get the n-th volatility forecast as well as the n-th return forecast, e.g. the predicted volatility for the next day as well as the return. In the case of the model m2 the volatility forecast will be the return forecast, since we assume a pure GARCH model. But how can we extract both in the m1case?


Edit: as asked by user12348 here are my outputs of summary(m1) and summary(m2).


> summary(m1)

Title:
GARCH Modelling

Call:

garchFit(formula = ~arma(3, 0) + garch(1, 1), data = sp5, trace = F)

Mean and Variance Equation:
data ~ arma(3, 0) + garch(1, 1)

[data = sp5]

Conditional Distribution:
norm


Coefficient(s):
mu ar1 ar2 ar3 omega
7.7077e-03 3.1968e-02 -3.0261e-02 -1.0649e-02 7.9746e-05
alpha1 beta1
1.2425e-01 8.5302e-01

Std. Errors:
based on Hessian

Error Analysis:

Estimate Std. Error t value Pr(>|t|)
mu 7.708e-03 1.607e-03 4.798 1.61e-06 ***
ar1 3.197e-02 3.837e-02 0.833 0.40473
ar2 -3.026e-02 3.841e-02 -0.788 0.43076
ar3 -1.065e-02 3.756e-02 -0.284 0.77677
omega 7.975e-05 2.810e-05 2.838 0.00454 **
alpha1 1.242e-01 2.247e-02 5.529 3.22e-08 ***
beta1 8.530e-01 2.183e-02 39.075 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Log Likelihood:
1272.179 normalized: 1.606287

Description:
Wed Apr 23 18:07:32 2014 by user:


Standardised Residuals Tests:
Statistic p-Value

Jarque-Bera Test R Chi^2 73.04843 1.110223e-16
Shapiro-Wilk Test R W 0.9857968 5.961505e-07
Ljung-Box Test R Q(10) 11.56744 0.3150483
Ljung-Box Test R Q(15) 17.78746 0.2740041
Ljung-Box Test R Q(20) 24.11916 0.2372259
Ljung-Box Test R^2 Q(10) 10.31614 0.4132084
Ljung-Box Test R^2 Q(15) 14.22819 0.5082978
Ljung-Box Test R^2 Q(20) 16.79404 0.6663039
LM Arch Test R TR^2 13.34305 0.3446074


Information Criterion Statistics:
AIC BIC SIC HQIC
-3.194897 -3.153581 -3.195051 -3.179018

>

and for summary(m2):


> summary(m2)

Title:

GARCH Modelling

Call:
garchFit(formula = ~garch(1, 1), data = sp5, cond.dist = "std",
trace = F)

Mean and Variance Equation:
data ~ garch(1, 1)

[data = sp5]


Conditional Distribution:
std

Coefficient(s):
mu omega alpha1 beta1 shape
0.00845504 0.00012485 0.11302582 0.84220210 7.00318063

Std. Errors:
based on Hessian


Error Analysis:
Estimate Std. Error t value Pr(>|t|)
mu 8.455e-03 1.515e-03 5.581 2.39e-08 ***
omega 1.248e-04 4.519e-05 2.763 0.00573 **
alpha1 1.130e-01 2.693e-02 4.198 2.70e-05 ***
beta1 8.422e-01 3.186e-02 26.432 < 2e-16 ***
shape 7.003e+00 1.680e+00 4.169 3.06e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Log Likelihood:
1283.417 normalized: 1.620476

Description:
Wed Apr 23 18:09:17 2014 by user:


Standardised Residuals Tests:
Statistic p-Value

Jarque-Bera Test R Chi^2 99.61249 0
Shapiro-Wilk Test R W 0.9836345 9.72802e-08
Ljung-Box Test R Q(10) 11.37961 0.3287173
Ljung-Box Test R Q(15) 18.2163 0.2514649
Ljung-Box Test R Q(20) 24.91842 0.2045699
Ljung-Box Test R^2 Q(10) 10.52266 0.3958941
Ljung-Box Test R^2 Q(15) 16.14586 0.3724248
Ljung-Box Test R^2 Q(20) 18.93325 0.5261686
LM Arch Test R TR^2 14.88667 0.247693


Information Criterion Statistics:
AIC BIC SIC HQIC
-3.228325 -3.198814 -3.228404 -3.216983

>

Answer



The mean could be the long run variance which is


sig2 = fit.Constant/(1-fit.GARCH{1}-fit.ARCH{1});

I hope this explains.



If not, note I ran this model through Matlab, I get different values. you can paste your m1 and m2 values and some other intermediate results so I can see why Matlab differs.


EDIT: The question refers to forecasting the returns. Using AR-GARCH model, $$r_t= μ+\epsilon_t$$ $$ z_t=\epsilon_t/σ_t $$ $z_t$ is white noise or i.i.d, and can take any distribution. $$σ_t^2=w+\alpha \epsilon_{t-1}^2+\beta σ_{t-1}^2$$ The predict function in R is forecasting $r_{t+k}$ where k is the periods into the future. It is also possible to forecast future variance, $σ_{t+k}^2$,as shown, using GARCH formula above.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...