Specifying a solution sample in Model within Program

For questions regarding programming in the EViews programming language.

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

otb
Posts: 3
Joined: Wed Aug 04, 2010 12:15 pm

Specifying a solution sample in Model within Program

Postby otb » Wed Aug 04, 2010 12:49 pm

I had a question about specifying a forecast sample (from a VAR-Model) in an EViews program:

I make the program run recursive VARs (with increasing sample size) and save them in separate files identified by the counters. I then turn each of these VARs into a Model using makemodel. Now I want to make out-of-sample forecasts from each model with the initial forecast point to start right after the estimation end-point.

I couldn't figure out how to do this within the loop. I tried to change the sample within the loop before using the .solve command, but still the program solves the model using the estimation sample. Is there a way around this?

Thanks for the help.

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

Re: Specifying a solution sample in Model within Program

Postby EViews Gareth » Wed Aug 04, 2010 1:15 pm

Sounds like you're doing the correct thing - setting the workfile sample, using a smpl statement, prior to issuing the solve command.

otb
Posts: 3
Joined: Wed Aug 04, 2010 12:15 pm

Re: Specifying a solution sample in Model within Program

Postby otb » Wed Aug 04, 2010 1:51 pm

ok, I guess the problem is the program is not saving the solution after each iteration; I only get the last in variables named _0 after each variable. How can I store the solutions in each iteration with a different name after a solve command in the loop?

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

Re: Specifying a solution sample in Model within Program

Postby EViews Gareth » Wed Aug 04, 2010 1:53 pm

Well an easy way would just be to create a new variable equal to the model solution each time. If your loop counter is !i, and the series you're solving for is Y (to give a solution series called Y_0), then just do this inside the loop:

Code: Select all

series y_0_{!i} = y_0

otb
Posts: 3
Joined: Wed Aug 04, 2010 12:15 pm

Re: Specifying a solution sample in Model within Program

Postby otb » Wed Aug 04, 2010 2:06 pm

that does it. thanks.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests