[R-SIG-Finance] Is it possible to import residuals of mean.model into variance.model in rugarch package or others?

alexios ghalanos alexios at 4dscape.com
Fri Dec 28 10:27:13 CET 2012

On 28/12/2012 07:31, SamuelS wrote:
> Hi, Alexios. Thanks a lot for your suggestions. I have tried the method and
> successfully pass mean.model residuals to variance.model as data and part of
> external.variable. Could you give me some further guidances for my several
> new problems listed below? I ask for apology if some of them seem shalow. I
> am a new fish for R and i am learning and trying hard.
> Firstly, i don't understand how to use the 'setstart=' and 'setbounds'
> methods on the spec as you had mentioned. I can only find them in
> 'uGARCHspec-class' in reference manual, yet it doesn't show how to put them
> in spec correctly. When i put
> 'setbounds=list("alpha1"=c(0,1),"beta1"=c(0,1))' into spec and run it, R
> reflects 'setbounds=list("alpha1"=c(0,1),"beta1"=c(0,1)) is of no use'. Does
> 'set.start' equals to 'start.pars=list()'? Is there a principle to follow
> when i provide starting values for regressor parameters?
setstart(spec)<-list(alpha1=0.04, beta1=0.9)

setstart is equivalent to set.start in the specification, as is setfixed 
to set.fixed.

In setting different bounds to the default ones for some of the 
parameters, particular care should be exercised as that may violate a 
model's stationarity conditions (e.g do not set beta1 >1).

The external regressor names for the variance equation are vxreg1, 
vxreg2, ...

The principle is that they should be sensible values in relation to the 
scale of your regressors vis-a-vis the typical variance range. Also 
note, that negative values may result in the variance if your regressors 
are not positive (you may therefore prefer to use the eGARCH model).

> Secondly, i got 'ugarchfit-->warning: solver failer to converge' problems
> when i use all solvers of rugarch package to fit my model. It has been
> confusing me how to set the 'solver.control' or 'fix.control' options
> properly to get a convergent result.
> In topic "rugarch package "Warning Message" for GARCH-Normal" presented by
> nserdar, you provided seven suggestions to deal with 'warning: failed to
> invert hessian' in order of likely importance. Though the warning i got is
> different from his, i still want to ask some questions about several of the
> suggestions:
> 1. Set  tol<delta (in solver.control).
>      Q:what are tol and delta, where can i find more details about
> solver.control settings?
In the documentation of each of the solvers used e.g. solnp in the 
Rsolnp package, nlminb in the stats package, nloptr in the nloptr 
package etc.
> 2. Use scaling (in fit.control).
>      Q:Is it correct to write 'scaling=1' or 'scaling=TRUE' to make scaling
> function?
> 3. Set stationarity to FALSE (sometimes this creates problems with the
> solver for some boundary cases).
This and scaling are BOTH off when using external regressors in the 
variance equation.

> 4. Use an alternate solver(s) (there are many now included).
Try "hybrid" (this follows a hybrid strategy of choosing another solver 
when the first one-solnp-fails)...for difficult problems try the gosolnp 

> 5. Change the default solver parameters.
> 6. Use starting values.
>      Q:How to change default solver parameters or use starting values
> properly, is there a principle to follow or other papers or books i need to
> read?
> 7. Check your data for extreme outliers or numbers of zeros.
>      Q:In the matrix of my exteral.variable, there are quite a lot of zeros.
> Does that affect the convergence?
Not for the external regressors, the zero problem is with the actual data.
> Here is part of my code:
> #external.regressors matrix 'DummyRessquaar' subdivide the asymetrique part
> of 'gjrGARCH'#
> spec=ugarchspec(variance.model=list(model="sGARCH",garchOrder=c(1,1),
> submodel=NULL,external.regressors=DummyRessquar,variance.targeting=FALSE),
> mean.model=list(armaOrder=c(0,0),include.mean=FALSE,archm=FALSE,archpow=1,arfima=FALSE,
> external.regressors=NULL,archex=FALSE),distribution.model="std",start.pars=list(),fixed.pars=list())
> fitSDummyRes=ugarchfit(spec,resar4,out.sample=0,solver="solnp",solver.control=list(),
> fit.control=list(stationarity=1,fixed.se=0,scale=0))
> (1: In .solnpsolver(pars, fun, Ifn, ILB, IUB, control, LB, UB, arglist) :
> rugarch-->warning: no convergence...)
> 2: In .sgarchfit(spec = spec, data = data, out.sample = out.sample,  :
> ugarchfit-->warning: solver failer to converge.
> Thanks for your kind and patience.
> Regards,
> Samuel
Finally, have a look in the inst folder of the package where there are 
numerous examples.

Please note that the development of rugarch & rmgarch has now been moved to:

> --
> View this message in context: http://r.789695.n4.nabble.com/Is-it-possible-to-import-residuals-of-mean-model-into-variance-model-in-rugarch-package-or-others-tp4653934p4654123.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