Specify and taste the GARCH model flavors
In the next chapters, you will see that GARCH models come in many flavors. You thus need to start off by specifying the mean model, the variance model and the error distribution that you want to use. The best model to use is application-specific. A realistic GARCH analysis thus involves specifying, estimating and testing various GARCH models.
In R, this is simple thanks to the rugarch
package of Alexios Ghalanos. This package has already been loaded for you. You will apply it to analyze the daily returns in sp500ret
.
This exercise is part of the course
GARCH Models in R
Exercise instructions
- Use
ugarchspec()
to specify that you want to estimate a standard GARCH(1,1) model with constant mean and a normal distribution for the prediction errors. - Use
ugarchfit()
to estimate the model by maximum likelihood. - Use the method
sigma()
to retrieve the estimated volatilities. - Plot the volatility predictions for 2017.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Specify a standard GARCH model with constant mean
garchspec <- ___(mean.model = list(armaOrder = ___),
variance.model = list(model = "___"),
distribution.model = "___")
# Estimate the model
garchfit <- ___(data = ___, spec = ___)
# Use the method sigma to retrieve the estimated volatilities
garchvol <- ___
# Plot the volatility for 2017
___(___["2017"])