string for model specification in equation environment

For questions regarding programming in the EViews programming language.

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

pekaype
Posts: 7
Joined: Sat Jan 11, 2014 8:21 pm

string for model specification in equation environment

Postby pekaype » Wed Mar 26, 2014 9:49 am

Hi

is it possible to use a string instead of manually writing down the model specification in and equation environment?`

Easy example, suppose this is the regression I want to run

Code: Select all

equation equ1.ls y c @movav(x1(0),3) x2
can I replace the model specification ie everything after "equ1.ls" with a string?
I have extracted the optimal model specification and lag structure for multitude of dependent variables, and the way it's set up is that the explanatory variables are enlisted in a string object. Most efficiently I would be able to incorporate this string into a loop, but I don't know if the equation environment lets me do so.

Easy example, let "_equ_y" be the string containing the optimal model specification eg.: "y c @movav(x1(0),3) x2"

Code: Select all

for %bestvar {_equ_y} equation _equ1_y.ls %bestvar show equ1_y_ next
obviously only returns the alpha values in the string. Ideas?

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

Re: string for model specification in equation environment

Postby EViews Gareth » Wed Mar 26, 2014 9:55 am

replace %bestvar with {%bestvar}

pekaype
Posts: 7
Joined: Sat Jan 11, 2014 8:21 pm

Re: string for model specification in equation environment

Postby pekaype » Wed Mar 26, 2014 10:03 am

Thanks Gareth, tried that before but gets me following error message:

"No coefficients specified in "euation equ1_y.ls y"

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

Re: string for model specification in equation environment

Postby EViews Gareth » Wed Mar 26, 2014 10:08 am

try putting an extra set of braces. {{%bestvar}}

pekaype
Posts: 7
Joined: Sat Jan 11, 2014 8:21 pm

Re: string for model specification in equation environment

Postby pekaype » Wed Mar 26, 2014 10:13 am

That gives me following error message "y is not a valid string or scalar name in "Equation..." "

Interestingly it always only refers to the first varaible specfied in that string, which would explain why it cannot execute the regression.

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

Re: string for model specification in equation environment

Postby EViews Gareth » Wed Mar 26, 2014 10:23 am

ok, I think we need more information on exactly what you're doing. The following program shows examples of how to do it in a variety of ways:

Code: Select all

create u 100 series y=nrnd series x1=nrnd series x2=nrnd string _equ_y = "y c @movav(x1(0),3) x2" equation eq1.ls {_equ_y} %bestvar = _equ_y equation eq2.ls {%bestvar} %bestvar = "_equ_y" equation eq3.ls {{%bestvar}} for %bestvar _equ_y equation _equ1_y.ls {{%bestvar}} next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests