GARCH Models in R
Kris Boudt
Professor of finance and econometrics
quantile()
applied to a ugarchroll
object.ugarchspec()
: Specify which GARCH model you want to use
garchspec <- ugarchspec(mean.model = list(armaOrder = c(1, 0)),
variance.model = list(model = "gjrGARCH"),
distribution.model = "sstd")
ugarchroll()
: Estimate the GARCH model on rolling estimation samples
garchroll <- ugarchroll(garchspec, data = sp500ret, n.start = 2500,
refit.window = "moving", refit.every = 100)
quantile()
: Compute the predicted quantile
garchVaR <- quantile(garchroll, probs = 0.05)
You can choose another loss probability: 1% and 2.5% are also popular
actual <- xts(as.data.frame(garchroll)$Realized, time(garchVaR))
VaRplot(alpha = 0.05, actual = actual, VaR = garchVaR)
A VaR exceedance occurs when the actual return is less than the predicted value-at-risk: $ R_t \ < {VaR}_t$.
The frequency of VaR exceedances is called the VaR coverage.
# Calculation of coverage for S&P 500 returns and 5% probability level
mean(actual < garchVaR)
0.05159143
distribution.model = "std"
instead of distribution.model = "sstd"
:
garchspec <- ugarchspec(mean.model = list(armaOrder = c(1, 0)),
variance.model = list(model = "gjrGARCH"),
distribution.model = "std")
Rolling estimation and 5% VaR prediction:
garchroll <- ugarchroll(garchspec, data = sp500ret, n.start = 2500,
refit.window = "moving", refit.every = 100)
garchVaR <- quantile(garchroll, probs = 0.05)
mean(actual < garchVaR) # returns 0.05783233
variance.model = list(model = "sGARCH")
instead of
variance.model = list(model = "gjrGARCH")
:
garchspec <- ugarchspec(mean.model = list(armaOrder = c(1, 0)),
variance.model = list(model = "sGARCH"),
distribution.model = "std")
Rolling estimation and 5% VaR prediction:
garchroll <- ugarchroll(garchspec, data = sp500ret, n.start = 2500,
refit.window = "moving", refit.every = 100)
garchVaR <- quantile(garchroll, probs = 0.05)
mean(actual < garchVaR) # returns 0.06074475
refit.every = 1000
instead of
refit.every = 100
:
garchspec <- ugarchspec(mean.model = list(armaOrder = c(1, 0)),
variance.model = list(model = "sGARCH"),
distribution.model = "std")
garchroll <- ugarchroll(garchspec, data = sp500ret, n.start = 2500,
refit.window = "moving", refit.every = 1000)
garchVaR <- quantile(garchroll, probs = 0.05)
mean(actual < garchVaR) # returns 0.06199293
GARCH Models in R