Open chm-von-tla opened 3 years ago
Thanks for the MWE! Unfortunately I haven't managed to fix this in general. In this particular example, you can do
using Optim
using ARCHModels
X = BG96[773:1272]
fit(EGARCH{1,1,1}, X, meanspec=AR{1}, dist=StdT, algorithm=BFGS(linesearch = Optim.BackTracking(order=3)))
but I'm not sure if this is more robust in general (feel free to test). It is definitely a bit slower for some models. One idea would indeed be to catch the error and then try the other line search algorithm. If your testing reveals that this helps, then we could put that into the package (although it still feels a bit hacky).
Cheers Simon
Hello Simon,
thank you for your input. I will try to familiarize myself with the Optim package, in order to test whether different values to the algorithm
argument of fit
can help us overcome this problem (of course taking performance into account).
One idea would indeed be to catch the error and then try the other line search algorithm. If your testing reveals that this helps, then we could put that into the package (although it still feels a bit hacky).
If a robust general solution to the problem cannot be found, I think that catching the exception, falling back to another algorithm and outputting a warning is the better alternative [1]. I fully agree that it is hacky, but in my opinion it is much more preferable than throwing an exception. What are your thoughts on this?
I will contact you again, after I have done some testing.
Best regards,
Charis
====================================================================
[1]: This is done by other packages as well. If you run this piece of code:
using ARCHModels
for i in 1:length(BG96)-100
fit(TGARCH{1,1,1},BG96[i:i+100],meanspec=AR{1},dist=StdT)
end
the LineSearches package outputs the following warning about ten times
┌ Warning: Failed to achieve finite new evaluation point, using alpha=0
└ @ LineSearches /home/chm/.julia/packages/LineSearches/Ki4c5/src/hagerzhang.jl:148
Consider the following example.
This fails instantly with the following error:
The data was specifically chosen to demonstrate this error. The error however isn't related to just that specific data; it happens often when EGARCH (and sometimes TGARCH) models are combined with AR mean specifications and StdT/StdSkewT distribution of errors
At present, my code that depends on ARCHModels is handling this error in a very naive manner:
It would be very helpful if
In either case sadly I cannot be of much help. For case 1 I'm not familiar enough with the codebase in order to suggest remedies and for case 2 I do not have the required expertise/familiarity with optimizers in order to help