[R-SIG-Finance] Error while using ugarchsim in Rugarch function --> error in calling in c function

ASHWINI PAL ashwinids2nd at gmail.com
Thu Jul 14 08:41:03 CEST 2016


I'm using rugarch for modelling financial time series of returns.

To simulate paths from fitted models, I've defined following function

funcsim <- function(x){
>
>   sim=ugarchsim(x,n.sim=10000,m.sim=5,n.start=1);
>   return(apply(sim at simulation$seriesSim,1,sum))
> }


i=0
> for(fit in Modelfits){
>
>   print(i)
>   sim=funcsim(fit)
>   i=i+1
> }


Modelfits is a named list variable with names PC1,PC2,PC3,PC4,PC5,,...,PC85.


I'm getting error

> ugarchsim-->error: error in calling C function....





Traceback for the error is

>
> stop("\nugarchsim-->error: error in calling C function....\n")
> 5
> .egarchsim1(fit = fit, n.sim = n.sim, n.start = n.start, m.sim = m.sim,
> startMethod = startMethod, presigma = presigma, prereturns = prereturns,
> preresiduals = preresiduals, rseed = rseed, custom.dist = custom.dist,
> mexsimdata = mexsimdata, vexsimdata = vexsimdata)
> startMethod = startMethod, presigma = presigma, prereturns = prereturns,
> preresiduals = preresiduals, rseed = rseed, custom.dist = custom.dist,
> mexsimdata = mexsimdata, vexsimdata = vexsimdata)4
> .egarchsim(fit = fit, n.sim = n.sim, n.start = n.start, m.sim = m.sim,
> startMethod = startMethod, presigma = presigma, prereturns = prereturns,
> preresiduals = preresiduals, rseed = rseed, custom.dist = custom.dist,
> mexsimdata = mexsimdata, vexsimdata = vexsimdata, ...)
> startMethod = startMethod, presigma = presigma, prereturns = prereturns,
> preresiduals = preresiduals, rseed = rseed, custom.dist = custom.dist,
> mexsimdata = mexsimdata, vexsimdata = vexsimdata, ...)3
> ugarchsim(x, n.sim = 10000, m.sim = 5, n.start = 1)
> 2
> ugarchsim(x, n.sim = 10000, m.sim = 5, n.start = 1)
> 1
> funcsim(fit)
>



Error randomly occurs for some of the series in the list.


But, while simulating individually i don't get any error. for example,

funcsim(Modelfits$PC84)



All the models fitted are of form egarch.


Please, can someone help me on this problem?

I've gone through the source code on github, still can't locate the cause
of error.

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list