Page 1 of 1

Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:02 pm
by AASA
What instruction is needed for an EViews program to run with an existing workfile? For example, I have a file with UNRATE in it and have several equations trying to forecast UNRATE. One such model is a nonlinear model that first requires the user to run a least squares model several times and extract the SSR to find the minimum SSR model. I see several examples of creating files with the program and then using nrnd to generate data, but I did not see an example of how to use a program with an existing workfile. I am a beginner related to programming EViews, so I may have missed the proper instruction while looking at examples or reading the manual. Thanks

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:10 pm
by startz

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:17 pm
by EViews Gareth
To expand on Startz' answer...

If you already have the workfile open and it is the only workfile open, you don't need to use any command - the program will automatically work on the current workfile.

If you have multiple workfiles open and need to tell the program which one to use, use the wfselect command to tell EViews which one to use.

If you don't have the workfile open, use wfopen to use it.

Finally, if you're not sure if you have it open or not, use wfuse.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:32 pm
by AASA
Thanks. What if I have the file open and want to run a given equation, (say EQ32) 20 times to extract the SSR? I read your example programs in which you ran equations several times to extract the Rsquared, but have not been able to change that program to accomplish my goal.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:34 pm
by EViews Gareth
Why would you want to extract SSR from the same equation 20 times?

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:40 pm
by startz
To expand on Gareth's answer...

Once you run an equation, it remembers all the values it produces until you change something. No need to re-run it. Also, you can run it once and save the value you want in a scalar for easy later reference.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 2:49 pm
by AASA
There is an example in Enders, Applied Econometric Time Series, 4th ed. on pages 425 to 436 concerning a Threshold model (TAR). He shows that the threshold is found at the minimum SSR. In the example case, running a given model 141 time as described on page 426 locates the minimum SSR. Page 435 shows Potential Thresholds and SSR in a chart.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 3:12 pm
by startz
Presumably, something changed in the equation between runs. You'll have to reference the equation object after each run.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 3:45 pm
by AASA
Yes, there is a two stage process. Find the threshold, which requires an input change in order to find the minimum SSR. This process took 141 iterations with the change variable in Enders book. Then, given the threshold value, forecast UNRATE. I was hoping to get some help to write the routine needed in order to make the change and run multiple iterations of an equation, with the change input in order to find the threshold value.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 6:28 pm
by EViews Gareth
You'll probably have to take a stab at writing it yourself before anyone will help.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 7:20 pm
by AASA
I am not shying from doing work, I am having a difficult time trying to find the instructions that tell the program to select an equation from an open workfile, change a given variable and then evaluate the equation for a given number of times and then store the SSR, similar to your example storing r2s. Some of the elements I see in your sample programs. It looks like a "for" instruction is needed (similar to a do loop in FORTRAN, from distant past). If you can recommend a beginners workbook, I would gladly read it.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 8:04 pm
by startz
AASA wrote:I am not shying from doing work, I am having a difficult time trying to find the instructions that tell the program to select an equation from an open workfile, change a given variable and then evaluate the equation for a given number of times and then store the SSR, similar to your example storing r2s. Some of the elements I see in your sample programs. It looks like a "for" instruction is needed (similar to a do loop in FORTRAN, from distant past). If you can recommend a beginners workbook, I would gladly read it.


To create an equation

Code: Select all

equation eq01
To select an equation

Code: Select all

eq01.ls y c x

Chapter 16 of http://www.eviews.com/illustrated/illustrated.html will help some on the programming.

Re: Program to run with existing workfile

Posted: Tue Jul 24, 2018 9:21 pm
by AASA
Thanks. I printed the chapter 16 pages from EViews Illustrated and will see if I can make some progress. Many years ago I took a couple semesters of FORTRAN, but have not done any programming in decades.