ComenzarEmpieza gratis

Out-of-sample forecasting

The garchvol series is the series of predicted volatilities for each of the returns in the observed time series sp500ret. For decision making, it is the volatility of the future (not yet observed) return that matters. You get it by applying the ugarchforecast() function to the output from ugarchfit() In forecasting, we call this the out-of-sample volatility forecasts, as they involve predictions of returns that have not been used when estimating the GARCH model.

This exercise uses the garchfit and garchvol objects that you created in the previous exercise. If you need to check which arguments a function takes, you can use ?name_of_function in the Console to access the documentation.

Este ejercicio forma parte del curso

GARCH Models in R

Ver curso

Instrucciones del ejercicio

  • Compute the unconditional volatility using the method uncvariance().
  • Print the estimated volatilities for the ten last returns in the sp500ret sample.
  • Use ugarchforecast() to forecast the volatility for the next five days.
  • Use sigma() to obtain the predicted volatilities for the next five days and print them.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Compute unconditional volatility
___(___(garchfit))

# Print last 10 ones in garchvol
tail(___, ___)

# Forecast volatility 5 days ahead and add 
garchforecast <- ___(fitORspec = garchfit, 
                     ___ = ___)

# Extract the predicted volatilities and print them
print(___(___))
Editar y ejecutar código