Page 1 of 1

Speed up model.control proc

Posted: Fri Nov 01, 2024 2:05 pm
by gmcatee
This post is long overdue, but when I upgraded from EViews 8.1 to EViews 12, I noticed that the model.control procedure was taking much longer to complete. Is there a difference in how the two versions perform this procedure? Are there any settings I can change to speed up the calculation?

I've constructed an example from the Fair Model (workfile attached).

Running the following code in EV8 takes about 5 seconds but takes almost 24 seconds in EV12

Code: Select all

tic for !repeat = 1 to 20 for %v CD CN CS CUR DF HF HO IHH IM INTG JF KK L1 L2 L3 LM MF PF RB RM RS WF Y fma_ev.control {%v}_a {%v} {%v} next next !time = @toc show !time

Re: Speed up model.control proc

Posted: Fri Nov 01, 2024 2:24 pm
by EViews Gareth
I’m afraid the control proc has undergone many revisions since EViews12, so you’re unlikely to get much feedback on such an old version.

Re: Speed up model.control proc

Posted: Fri Nov 01, 2024 2:40 pm
by gmcatee
Understood. It sounds like there are no options that can be adjusted by the user -- is that right?

I am curious though -- are you able to run the code with this workfile in EV14 to see how long it takes there? I get similar results using a 7-year-old laptop and a brand new one, so the system specs shouldn't make a difference. We use this function hundreds of times when updating the forecast, so the few seconds difference adds up.

Re: Speed up model.control proc

Posted: Fri Nov 01, 2024 3:01 pm
by EViews Gareth
16 seconds.

Re: Speed up model.control proc

Posted: Fri Nov 01, 2024 4:19 pm
by gmcatee
Got it, thanks. If you stumble on anything that might make this run faster please let me know. For now, we're clinging on to EV8 for this part of our process

Re: Speed up model.control proc

Posted: Sat Nov 02, 2024 10:14 am
by tvonbrasch
Hi,

It’s not a perfect solution, but rewriting the equation might help, i.e. from "equation" to "-x_a+equation" and then solve for x_a. See the details below and in the attachment. This adjustment reduces the execution time from 25 seconds to 8 seconds.
t


Code: Select all

' '-------------------------------------------------------------------- !i=!i+1 %mn=%m+%v %mn=@getnextname(%mn) copy {%m} {%mn} {%mn}.scenario(n,alias="_zer") zero %equation="eq??_"+%v %equation=@wflookup(%equation, "equation") %subst={%equation}.@subst %add=%v+"_a" %subst0 = "-"+%add+"+"+%subst {%mn}.drop {%v} {%mn}.append {%subst0} {%mn}.solve copy(o) {%add}_zer {%add} delete {%mn} *_zer '--------------------------------------------------------------------

Re: Speed up model.control proc

Posted: Mon Nov 04, 2024 7:12 am
by gmcatee
Thanks Thomas - I'll give this a try when I have some down time this week

Re: Speed up model.control proc

Posted: Mon Nov 04, 2024 5:47 pm
by EViews Matt
Hello,

Elaborating on Gareth's response, there was a major update to the Model::control procedure in EView 12 when we introduced the ability for multivariate controls. While I'd describe the new algorithm as numerically superior overall, it can be more computationally intensive even in the univariate case. If you absolutely can't afford the resulting extra time, it's still possible to use the old pre-EViews 12 univariate control algorithm by adding the "legacy" option to the control procedure, e.g.

Code: Select all

fma_ev.control(legacy) {%v}_a {%v} {%v}

Re: Speed up model.control proc

Posted: Wed Nov 06, 2024 12:28 pm
by gmcatee
Great, thanks for the tip Matt - that works for my application