9
$\begingroup$

I used SPY data to fit GARCH(1,1) in my model. My data starts from Jan, 2000 until Dec, 2013. I compared the volatility using runSD on the 21 rolling window and GARCH(1,1). It looks a pretty good fit so far.

My question would be how can I forecast the future volatility going forward from Dec, 2013? Should I just use the coefficient to calculate the next day's volatility? But what about if I want to simulate 10 days ahead? Is there a simple way to do this in R? I looked at ugarchroll and I don't really understand that function. Hope you guys can shed some lights!

Thank you!

Here are the coeffs and summary of GARCH using tseries package:

Call:
garch(x = dailyreturn[, 1], order = c(1, 1))

Coefficient(s):
       a0         a1         b1  
1.637e-06  8.857e-02  9.001e-01  


Call:
garch(x = dailyreturn[, 1], order = c(1, 1))

Model:
GARCH(1,1)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.1755 -0.5418  0.0716  0.6266  4.0432 

Coefficient(s):
    Estimate  Std. Error  t value Pr(>|t|)    
a0 1.637e-06   2.266e-07    7.223  5.1e-13 ***
a1 8.857e-02   7.074e-03   12.520  < 2e-16 ***
b1 9.001e-01   7.916e-03  113.703  < 2e-16 ***
---
Signif. codes:  0 ?**?0.001 ?*?0.01 ??0.05 ??0.1 ??1

Diagnostic Tests:
    Jarque Bera Test

data:  Residuals
X-squared = 358.7767, df = 2, p-value < 2.2e-16


    Box-Ljung test

data:  Squared.Residuals
X-squared = 7.8313, df = 1, p-value = 0.005135
$\endgroup$

2 Answers 2

6
$\begingroup$

Ah, this is becoming a common question, just in R now. Please look at this [question] (GARCH model and prediction), it has R code to do the prediction.

In brief, you keep predicting one day ahead. $\sigma_{t+k}^2 =w+\alpha u_{t+k-1}^2+\beta \sigma_{t+k-1}^2$. You already know $ w,\space \alpha \space and \space \beta $ the starting values are the last values in the returns time series and Garch variance at that time. So, the first forecast will become $\sigma_{t+1}^2 =w+\alpha u_{t}^2+\beta \sigma_{t}^2$ and 2nd day forecast will be $\sigma_{t+2}^2 =w+\alpha u_{t+1}^2+\beta \sigma_{t+1}^2$ and so on...

$\endgroup$
3
$\begingroup$

Why don't you use rugarch package? You can refer to author's example webpage via A short introduction to the rugarch package.

## example forc1 = ugarchforecast(fit, n.ahead = 500) forc2 = ugarchforecast(spec, n.ahead = 500, data = sp500ret[1:1000, , drop = FALSE]) forc3 = ugarchforecast(spec, n.ahead = 1, n.roll = 499, data = sp500ret[1:1500, , drop = FALSE], out.sample = 500) f1 = as.data.frame(attributes(forc1)[[1]]$seriesFor[1]) f2 = as.data.frame(attributes(forc2)[[1]]$seriesFor[1]) f3 = t(as.data.frame(attributes(forc3)[[1]]$seriesFor[1], which = 'sigma', rollframe = 'all', aligned = FALSE)) U = uncvariance(fit)^0.5

n.ahead is the parameter for forecast how many days in advance. Kindly refer to Forecasting using rugarch package.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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