Program to run with existing workfile

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

AASA
Posts: 30
Joined: Fri Jun 29, 2018 2:37 pm

Program to run with existing workfile

Postby AASA » Tue Jul 24, 2018 2:02 pm

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Program to run with existing workfile

Postby startz » Tue Jul 24, 2018 2:10 pm


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

Re: Program to run with existing workfile

Postby EViews Gareth » Tue Jul 24, 2018 2:17 pm

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

AASA
Posts: 30
Joined: Fri Jun 29, 2018 2:37 pm

Re: Program to run with existing workfile

Postby AASA » Tue Jul 24, 2018 2:32 pm

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.

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

Re: Program to run with existing workfile

Postby EViews Gareth » Tue Jul 24, 2018 2:34 pm

Why would you want to extract SSR from the same equation 20 times?
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Program to run with existing workfile

Postby startz » Tue Jul 24, 2018 2:40 pm

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.

AASA
Posts: 30
Joined: Fri Jun 29, 2018 2:37 pm

Re: Program to run with existing workfile

Postby AASA » Tue Jul 24, 2018 2:49 pm

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.

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Program to run with existing workfile

Postby startz » Tue Jul 24, 2018 3:12 pm

Presumably, something changed in the equation between runs. You'll have to reference the equation object after each run.

AASA
Posts: 30
Joined: Fri Jun 29, 2018 2:37 pm

Re: Program to run with existing workfile

Postby AASA » Tue Jul 24, 2018 3:45 pm

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.

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

Re: Program to run with existing workfile

Postby EViews Gareth » Tue Jul 24, 2018 6:28 pm

You'll probably have to take a stab at writing it yourself before anyone will help.
Follow us on Twitter @IHSEViews

AASA
Posts: 30
Joined: Fri Jun 29, 2018 2:37 pm

Re: Program to run with existing workfile

Postby AASA » Tue Jul 24, 2018 7:20 pm

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.

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Program to run with existing workfile

Postby startz » Tue Jul 24, 2018 8:04 pm

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.

AASA
Posts: 30
Joined: Fri Jun 29, 2018 2:37 pm

Re: Program to run with existing workfile

Postby AASA » Tue Jul 24, 2018 9:21 pm

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.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 32 guests