Get startedGet started for free

In-sample versus rolling sample vol

For a given time series of returns, you can estimate the GARCH volatility using the method sigma() applied to the output from ugarchfit or by using the as.data.frame() method to the output from ugarchroll. The difference is that ugarchfit leads to an in-sample estimate of volatility obtained by estimating the GARCH model only once and using the complete time series, while ugarchroll re-estimates the model and uses only the returns that are actually observable at the time of estimation. In this exercise you need to compare the resulting volatility predictions for the daily S&P 500 returns using an AR(1) GJR GARCH model with skewed student t distribution. The GARCH specification to use is already specified and available as garchspec, while the data are in sp500ret.

This exercise is part of the course

GARCH Models in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Estimate the GARCH model using all the returns and compute the in-sample estimates of volatility
garchinsample <- ___(data = sp500ret, spec = garchspec)
garchvolinsample <- ___(___)
Edit and Run Code