[R-SIG-Finance] help with ugarchsim error

alexios alexios at 4dscape.com
Wed Feb 25 21:26:27 CET 2015


This is likely related to the standardized data you are passing to the 
simulation function.

For instance, this _minimally reproducible example_ produces no problems:

data(sp500ret)
fit = ugarchfit(ugarchspec(), sp500ret)
simz = rnorm(1000000)

sim = ugarchsim(fit, n.sim=1000000, m.sim=1,
startMethod="sample", n.start=0, custom.dist=list(name="sample",
distfit=matrix(simz, ncol=1)))

So you need to check the values of your "SPD.sim.1" i.e. that they 
contain no NA's, Inf etc.

Alexios

On 25/02/2015 18:28, Gareth McEwan wrote:
> Hi there
>
> I was wondering if anyone can help me with an error that is thrown from the
> ugarchsim() function in the rugarch package. I have used this function a
> number of times in the past with success, so I am unsure of why it is
> throwing an error now.
>
> The error is:
>
> "Error in .sgarchsim1(fit = fit, n.sim = n.sim, n.start = n.start, m.sim =
> m.sim,  :
> ugarchsim-->error: error in calling C function...."
>
> I have loaded in:
> library(rugarch)
> library(Rcpp)
> library(RcppArmadillo)
>
> My code is:
>
> sim.ALSI.SPD = ugarchsim(garchfit.ALSI, n.sim=1000000, m.sim=1,
> startMethod="sample", n.start=0,
>                           custom.dist=list(name="sample",
> distfit=matrix(SPD.sim.1, ncol=1)))
>
> where:
> "garchfit.ALSI" is my variable from the ugarchfit(...) function;
> SPD.sim.1 = qspd(u.SPD.1, fit.ALSI) - a set of standardized residuals;
> with u.SPD.1 = pt(x.SPD.1, df=7.2137167865) - a set of uniform variates;
> "x.SPD.1" a column of simulated data from a previous copula fit;
> "fit.ALSI" is my fitted object from "spdfit( standardized GARCH residuals,
> ... )"
>
> Any ideas for a solution, or why the function is now throwing an error?
>
> Many thanks
> Gareth
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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