[R-SIG-Finance] Are my VaR forecasts correct (using rugarch)?
Alexandra Bridges
alexandbridges at gmail.com
Tue Jun 4 15:25:10 CEST 2013
Hi,
I am using the rugarch package and especially the command ugarchroll
to do a rolling forecasting to calculate the VaR.
I am using the sp500ret of the rugarch package:
library(rugarch)
data(sp500ret)
This is daily data. I now want to fit a GARCH model every 100th day.
The window size should be 255 observations. So my GARCH model should
take the last recent 255 observations. Therefore the first VaR
forecast belongs to the 256th day (this is in this dataset the
11.03.1988).
My code is:
# model specification
spmodel<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder
= c(1, 1)),
mean.model = list(armaOrder = c(0, 0), include.mean = FALSE),
distribution.model = "norm")
# model fit
spgarchmodel<-ugarchfit(spec=spmodel,data=sp500ret)
# now rolling forecasts with ugarchroll
# observations available in total:
length(sp500ret[,1])
roll = ugarchroll(spmodel, sp500ret, n.start=255,
refit.every = 100, refit.window = 'moving', window.size = 255,
calculate.VaR = TRUE, keep.coef = TRUE)
show(roll)
# or the following alternatively also works:
roll = ugarchroll(spmodel, sp500ret, forecast.length=(length(sp500ret[,1]))-255,
refit.every = 100, refit.window = 'moving', window.size = 255,
calculate.VaR = TRUE, keep.coef = TRUE)
show(roll,which=4)
First: Is this right what I am doing? Since both methods lead to the
same result I think I am correct, right?
Second:
The backtest shows the following:
report(roll,type="VaR",VaR.alpha=0.01,conf.level=0.99)
That means, I have far more exceedances than expected. So my model is
not good, why? What am I doing wrong? Is this due to a bad model
specification or due to an error in my code?
--
Alexa Bridges
More information about the R-SIG-Finance
mailing list