[R-SIG-Finance] Are my VaR forecasts correct (using rugarch)?
Alexandra Bridges
alexandbridges at gmail.com
Sat Jun 8 09:56:26 CEST 2013
Thanks a lot for your answer!
One question for me remains:
I use a simple model fit like this (so no rolling estimation):
spgarchmodel<-ugarchfit(spec=
spmodel,data=sp500ret)
now I can get the sigma values with
sigma(spgarchmodel)
I know how to calculate them recursively, but what about
sigma(spgarchmodel)[1] ?
How is this value calculated?
I tried the following:
The initial sigma_0 is set to the unconditional variance. So in case
of a GARCH(1,1) this would be:
omega/(1-alpha1-beta1)
This is inserted into the GARCH(1,1) formula, the "residual value"
epsilon_0 is set to the return of the first date, so:
sqrt(omega+alpha1*return_ofthefirstdate^2 + beta1*unconditional_variance)
But this gives a sligthly different value?
Thanks a lot for your answer!
2013/6/5 alexios ghalanos <alexios at 4dscape.com>:
> Hi,
>
> 1. You can easily check whether you are getting the forecast at the date you
> want by inspecting the returned forecast density data.frame:
> as.data.frame(roll, which = "density")
> OR VaR:
> as.data.frame(roll, which = "VaR")
> If you provided an xts object, then the dates in the data.frame rownames
> will provide you with the answer.
>
> Have you tried help('uGARCHroll-class') ?
>
> 2. "show(roll,which=4)". There is no documented method 'show' which
> takes on additional arguments 'which'.
>
> 3. 'report(roll,type="VaR",VaR.alpha=0.01,conf.level=0.99)'
> This is a formal test of the conditional coverage. You ask WHY your model
> does not pass the test. ONLY YOU can answer that question given you
> knowledge of YOUR data.
> However, it is usually unlikely that the normal distribution provides for a
> good fit to the observed security return dynamics in financial markets (try
> distribution.model='jsu').
> Also, if you search previous postings you may see that a data length of 255
> may not be adequate for modelling the volatility process persistence. There
> is a blog post on this question you may find useful
> (http://www.unstarched.net/2012/12/26/garch-parameter-uncertainty-and-data-size/).
>
>
> Regards,
>
> Alexios
>
>
>
>
> On 04/06/2013 14:25, Alexandra Bridges wrote:
>>
>> 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
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>
--
Alexa Bridges
More information about the R-SIG-Finance
mailing list