[R-SIG-Finance] rugarch VaR calculation "manually"

Neuman Co neumancohu at gmail.com
Tue May 7 13:15:18 CEST 2013


I am using the rugarch package in R and I have some questions:

I want to use the rugarch package to calculate the VaR.

I used the following code to to fit a certain model:

spec2<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder =
c(1, 1)),
mean.model = list(armaOrder = c(5, 5), include.mean = FALSE),
distribution.model =
"norm",fixed.pars=list(ar1=0,ar2=0,ar3=0,ma1=0,ma2=0,ma3=0))

model2<-ugarchfit(spec=spec2,data=mydata)

Now I can look at the 2.5 % VaR with the following command:
plot(model)

and choosing the second plot.

Now my first question is: How can I get the 1.0% VaR VALUES, so not
the plot, but
the values/numbers?

In case of the normal distribution, one can easily do the calculation of
the VaR with using the forecasted conditional volatility and the forecasted
conditional mean:

I use the ugarchforecast command and with that I can get the cond. volatility
and cond. mean (my mean equation is an modified ARMA(5,5), see above in the spec
command):

forecast = ugarchforecast(spec, data, n.roll = , n.ahead = , out.sample=)

# conditional mean
cmu = as.numeric(as.data.frame(forecast, which = "series",
rollframe="all", aligned = FALSE))
# conditional sigma
csigma = as.numeric(as.data.frame(forecast, which = "sigma",
rollframe="all", aligned = FALSE))

I can calculate the VaR by using the property, that the normal distribution
is part of the location-scale distribution families

# use location+scaling transformation property of normal distribution:
VaR = qnorm(0.01)*csigma + cmu

My second question belongs to the n.roll and out.sample command. I had
a look at the
description http://www.inside-r.org/packages/cran/rugarch/docs/ugarchforecast
but I did not understand the n.roll and out.sample command. I want to
calculate the
daily VaR, so I need one step ahead predicitons and I do not want to reestimate
the model every time step. So what does it mean "to roll the forecast
1 step " and
what is out.sample?

My third question(s) is (are): How to calculate the VaR in case of a
standardized
hyperbolic distribution? Can I still calculate it like in the normal case
or does it not work anymore (I am not sure, if the sdhyp belongs to the
location-scale family).

Even if it does work (so if the sdhyp belongs to the family of
location-scale distributions) how do I calculate it in case of a
distribution, which does not belong to the location-scale family?
(I mean, if I cannot calculate it via VaR = uncmean + sigma* z_alpha how
do I have to calculate it). Which distribution implemented in the rugarch
package does not belong to the location-scale family?

Thanks a lot for your help!



More information about the R-SIG-Finance mailing list