[R-SIG-Finance] VaR calculation warning with rugarch
alexios
alexios at 4dscape.com
Sun Aug 16 19:15:42 CEST 2015
You can ignore the warning. You can calculate the values yourself and
check that the results are the same:
df = as.data.frame(bi.backtest.nig)
q = quantile(bi.backtest.nig,0.01)
q10 =
qdist("nig",0.01,mu=0,sigma=df[10,"Sigma"],skew=df[10,"Skew"],shape=df[10,"Shape"])
as.numeric(q[10])==q10
> TRUE
q5 =
qdist("nig",0.01,mu=0,sigma=df[5,"Sigma"],skew=df[5,"Skew"],shape=df[5,"Shape"])
as.numeric(q[5])==q5
> TRUE
The warning will be fixed in the development version (...soon).
Alexios
On 16/08/2015 17:55, Mingersming wrote:
> Hi all,
>
> there is one issue I can´t go one myself. I try to fit a nig-distribution in
> a rolling window method to a time-series with the fantastic rugarch package.
> I use the option 'calculate.VaR' for several other distributions and it
> works fine, but if I switch to the nig-distribution, I recieve the following
> warning:
>
> In ans[i] = mu[i] + sigma[i] * .qsnigC(p, rho = skew[i], ... :number of
> items to replace is not a multiple of replacement length
>
> I tried to turn off the option and calculate the quantile on my own. I think
> there is an misstake with the number of the parameters, but what can I
> change to get over?
>
> For code, see below
>
> Best regards
>
> library(quantmod)
> library(rugarch)
> library(PerformanceAnalytics)
>
> bi <- getSymbols('^GDAXI', from = "2004-01-01", to = "2015-08-01")
> bi <- Ad(get(bi[1]))
> bi_tlr <- Return.calculate(bi, method = "log")
> bi_tlr <- na.omit(bi_tlr)
>
> ctrl = list(rho = 1, delta = 1e-11, outer.iter = 1000, tol = 1e-12)
> cl = makePSOCKcluster(10)
>
> T = nrow(bi_tlr)
> t_bt <- nrow(as.xts(bi_tlr)["2006-01-01/2015-08-01"])
> t_est <- T - t_bt
>
> spec_nig = ugarchspec(variance.model = list(model = "sGARCH", garchOrder =
> c(1,1)),
> mean.model = list(armaOrder = c(0,0), include.mean = FALSE),
> distribution.model = "nig")
>
> bi.backtest.nig = ugarchroll(spec_nig, data = bi_tlr, n.ahead = 1,
> forecast.length = 10, refit.every = 1, refit.window = "moving", solver =
> "hybrid", fit.control = list(), solver.control = ctrl, calculate.VaR = TRUE,
> VaR.alpha = c(0.01,0.05), cluster = cl,keep.coef = TRUE)
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/VaR-calculation-warning-with-rugarch-tp4711164.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> 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.
>
More information about the R-SIG-Finance
mailing list