IniziaInizia 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.

Questo esercizio fa parte del corso

GARCH Models in R

Visualizza il corso

Istruzioni dell'esercizio

  • 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.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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(___(___))
Modifica ed esegui il codice