Help implementing GARCH model

4 visualizaciones (últimos 30 días)
Josh V
Josh V el 27 de Ag. de 2015
Comentada: Josh V el 3 de Sept. de 2015
Im trying to use this package:
Specifically garchvar.m in that package.
The function is VaR = garchvar(data, model, distr, ar, ma, p, q, max_forecast, alpha) so I try something like
garchvar(lreturns, 'GARCH', 'GAUSSIAN', 1, 1, 1, 1, 5, 0.99) and I get the error message: "The constructor for class 'garch' must return only one output value".
Can anyone advise what Im doing wrong.
Thanks

Respuestas (1)

Cam Salzberger
Cam Salzberger el 31 de Ag. de 2015
Hello Josh,
I understand that you are receiving an error when trying to call a function in a third party toolbox. The issue you are experiencing is the result of naming conflicts. The ARMAX-GARCH third party toolbox is trying to call a function garch, but there exists a class garch , with a constructor by the same name, in the built-in Econometrics Toolbox. Note that the garch object was introduced in the Econometrics Toolbox in R2012a, and the ARMAX-GARCH toolbox was last updated in 2011, so it is not the fault of the toolbox authors.
The MATLAB function precedence rules are such that class constructors in class folders would be called before functions in the current folder. The ideal fix to this is to change the ARMAX-GARCH garch function to a different name. However, you would also have to change every call to it from the toolbox to that name as well, which may be prohibitively time-consuming.
If you do not ever need to call the garch function explicitly outside of that toolbox, an alternative would be to put the garch function in a "private" folder within the toolbox. This works because functions in "private" folders have a higher precedence than class constructors. If you do this, the other toolbox functions can still access the toolbox's garch function, and calls to garch in code outside that toolbox will call the built-in class constructor.
I hope this helps resolve the issue.
-Cam
  1 comentario
Josh V
Josh V el 3 de Sept. de 2015
Thank you for this answer. Just got round to implementing this and it seems to have solved the problem.

Iniciar sesión para comentar.

Categorías

Más información sobre Conditional Variance Models en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by