Poor performance of BFGS

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Poor performance of BFGS

Postby trubador » Mon Apr 27, 2015 2:00 am

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: viewtopic.php?f=15&t=12139#p42414

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Poor performance of BFGS

Postby trubador » Mon Apr 27, 2015 6:08 am

For another case, please see: viewtopic.php?f=5&t=12138#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.

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: Poor performance of BFGS

Postby EViews Glenn » Mon Apr 27, 2015 7:38 am

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.

rousing
Posts: 74
Joined: Fri Jun 11, 2010 5:56 am
Location: Switzerland

Re: Poor performance of BFGS

Postby rousing » Fri May 29, 2015 5:13 am

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
Attachments
garch_optimizer_testing.prg
(2.67 KiB) Downloaded 304 times
garch_optimizer_testing_clean.wf1
(1.23 MiB) Downloaded 325 times

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: Poor performance of BFGS

Postby EViews Glenn » Fri May 29, 2015 10:21 am

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.

jibe
Posts: 7
Joined: Thu Jul 23, 2015 7:52 am

Re: Poor performance of BFGS

Postby jibe » Thu Jul 23, 2015 8:13 am

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.

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: Poor performance of BFGS

Postby EViews Glenn » Thu Jul 23, 2015 1:16 pm

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).

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Poor performance of BFGS

Postby EViews Gareth » Sat Jul 25, 2015 12:22 am

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.
Follow us on Twitter @IHSEViews

jibe
Posts: 7
Joined: Thu Jul 23, 2015 7:52 am

Re: Poor performance of BFGS

Postby jibe » Mon Jul 27, 2015 12:28 am

Thanks. Will do.

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Poor performance of BFGS

Postby trubador » Thu Sep 03, 2015 1:46 am

Here is another case: 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


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 23 guests