Page 1 of 1

Poor performance of BFGS

Posted: Mon Apr 27, 2015 2:00 am
by trubador
I have noticed that BFGS optimizer does a poor job in some GARCH and State Space models, where the Legacy option works just fine. I'll try to post each instance as it occurs. This is just to give you a heads up. As a recent example, you may want to check the following code: http://forums.eviews.com/viewtopic.php? ... 139#p42414

Re: Poor performance of BFGS

Posted: Mon Apr 27, 2015 6:08 am
by trubador
For another case, please see: http://forums.eviews.com/viewtopic.php? ... 138#p42419
Just run the code generating some artificial r series and you'll see that BFGS fails to estimate the GARCH model at some point. It never happens with the Legacy option, though.

Re: Poor performance of BFGS

Posted: Mon Apr 27, 2015 7:38 am
by EViews Glenn
My guess is that it probably doesn't do as well when the starting values are poor. That's partly BFGS, and partly the trust region approach. The Legacy tends to be more aggressive in starting out. Let me think about ways of improving things or offering more options that might help, or perhaps going back to the original default.

Re: Poor performance of BFGS

Posted: Fri May 29, 2015 5:13 am
by rousing
Hi

Just a few remarks/observations in relation to the above subject.
First of all, the estimates from the new optimization methods now look a lot better compared to the legacy ones - relative to when the above post was originally made
and I first started testing Eviews 9.
However, I would like to highlight two issues which I have observed when testing - the first is that the newton/raphson method appear to stall at some point when looping if the equation object is not
deleted after each estimation in the loop.
The second thing is that the failure of bfgs in roughly 1% of the cases does not seem to be related to the starting values (at least the ones I have tested) which might indicate something else is going on.
I have attached the code and workfile to illustrate my findings - unfortunately the completed file is to big to upload - but the main results are in the compare_estimates page - furthermore
running the code should hopefully re-create my findings.

Best regards
Rasmus

Re: Poor performance of BFGS

Posted: Fri May 29, 2015 10:21 am
by EViews Glenn
Thanks. We are always looking to improve our performance and the hope is that your observations and the enclosed info will aid us in doing so.

Re: Poor performance of BFGS

Posted: Thu Jul 23, 2015 8:13 am
by jibe
Is there an option to the ml command that will switch to the legacy method?
I want to reproduce my results from an Eviews 8 program estimating a series of logl objects.

Re: Poor performance of BFGS

Posted: Thu Jul 23, 2015 1:16 pm
by EViews Glenn
Yes. It's documented in the manual and the online help [edit]....er...at least it should have been.

optmethod = arg Optimization method :
“bfgs” (BFGS);
“newton” (Newton-Raphson),
“opg” or “bhhh” (OPG or BHHH),
“legacy” (EViews legacy).

cov=arg Covariance method:
“ordinary” (default method based on inverse of the estimated information matrix),
“huber” or “white”

covinfo = arg Information matrix method (applicable when non-legacy “optmethod=”.)
“opg” (OPG) (default method)
“hessian” (observed Hessian).

Re: Poor performance of BFGS

Posted: Sat Jul 25, 2015 12:22 am
by EViews Gareth
Further to Glenn's reply, in general if you want to know the command to do something, use the interface and then looking at the command capture window to find the command.

Re: Poor performance of BFGS

Posted: Mon Jul 27, 2015 12:28 am
by jibe
Thanks. Will do.

Re: Poor performance of BFGS

Posted: Thu Sep 03, 2015 1:46 am
by trubador
Here is another case: http://forums.eviews.com/viewtopic.php?f=4&t=12968
Legacy option finds a better solution. If you run the model in EViews 8, it converges to an even better solution.
I ran the following version of the code:

Code: Select all

smpl @all series r1 = dlog(spot) series r2 = dlog(futures) sample s0 @first @last-5 sample s1 @first+2 @last-5 smpl s0 equation eq1.arch(m=100,c=1e-5,h,b) r1 c equation eq2.arch(m=100,c=1e-5,h,b) r2 c coef(2) mu mu(1) = eq1.c(1) mu(2)= eq2.c(1) coef(3) omega omega(1)=eq1.c(2) omega(2)=0 omega(3)=eq2.c(2) coef(3) alpha alpha(1) = eq1.c(3) alpha(2) = eq2.c(3) alpha(3) = 0 coef(3) beta beta(1)= eq1.c(4) beta(2)= eq2.c(4) beta(3) = 0 !mlog2pi = 2*log(2*@acos(-1)) series cov_r1r2 = @cov(r1-mu(1), r2-mu(2)) series var_r1 = @var(r1) series var_r2 = @var(r2) series sqres1 = (r1-mu(1))^2 series sqres2 = (r2-mu(2))^2 series res1res2 = (r1-mu(1))*(r2-mu(2)) logl bvgarch bvgarch.append @logl logl bvgarch.append sqres1 = (r1-mu(1))^2 bvgarch.append sqres2 = (r2-mu(2))^2 bvgarch.append res1res2 = (r1-mu(1))*(r2-mu(2)) bvgarch.append var_r1 = omega(1)+beta(1)*var_r1(-1) + alpha(1)*sqres1(-1) bvgarch.append var_r2 = omega(3)+beta(2)*var_r2(-1) + alpha(2)*sqres2(-1) bvgarch.append cov_r1r2 = omega(2) +beta(3)*cov_r1r2(-1) + alpha(3)*res1res2(-1) bvgarch.append deth = var_r1*var_r2 -cov_r1r2^2 bvgarch.append invh1 = var_r2/deth bvgarch.append invh3 = var_r1/deth bvgarch.append invh2 = -cov_r1r2/deth bvgarch.append logl =-0.5*(!mlog2pi +(invh1*sqres1+2*invh2*res1res2 +invh3*sqres2)+ log(deth)) smpl s1 'bvgarch.ml(showopts, m=500, c=1e-5) 'BFGS bvgarch.ml(optmethod=legacy, conv=1e-5, showopts) 'Legacy series res1 = sqres1^.5 series res2 = sqres2^.5 series stres1 = res1 /(var_r1 ^ .5) series stres2 = res2 /(var_r2 ^ .5) series sqres1st = stres1^2 series sqres2st = stres2^2 series stres1res2 = res1*res2/(var_r1*var_r2)^.5 graph resids1.line stres1 r1 show resids1 graph resids2.line stres2 r2 show resids2 show bvgarch.output graph varcov.line var_r1 var_r2 cov_r1r2