Change pre-estimated equation

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

Posts: 27
Joined: Tue Aug 27, 2013 1:10 am

Change pre-estimated equation

Postby Karl1 » Fri Nov 15, 2013 6:46 am

How does one change a pre-estimated equation with the use of commands?
Example: How to change
y = y(-1) + x
y = y(-4) + x

I do not want to reestimate the equation. I want to keep all coeffisient values.

EViews Glenn
EViews Developer
Posts: 2616
Joined: Wed Oct 15, 2008 9:17 am

Re: Change pre-estimated equation

Postby EViews Glenn » Fri Nov 15, 2013 12:50 pm

Unlink the equation in the model and edit the text [edit...sorry, missed the "with commands" part...I've asked Chris to look at this one as he's up-to-date on what can be done with command syntax in models].

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Change pre-estimated equation

Postby EViews Chris » Fri Nov 15, 2013 4:58 pm

A number of commands to modify the model text were added in EViews v8.

replacevar is probably the one you're interested in.

eg. m.replacevar y(-1) y(-4)

will change *all* occurrences of y(-1) in the model text to y(-4).

If you only want to change a single equation you would have to extract the equation text from the model using something like:

string a = m.@spec("y")

manipulate it however you want, then put it back into the model with:

m.replace {a}

Posts: 15
Joined: Wed Mar 12, 2014 6:52 am

'replacevar' command

Postby HollEviews » Tue Apr 29, 2014 5:21 am

I am having difficulting figuring out how to use the 'replacevar' command to modify model equations. I have tried the following:

equation dlog(gid_a) = c(1) + c(2)*(log(gid_a(-1)) - log(yed_a(-1))) + c(3)*dlog(yed_a) + c(4)*dlog(gid_a(-1))

minmod4.append :eqgid

minmod4.unlink gid_a

minmod4.replacevar yed_a ypd_a

The unlinking works fine, so the model equation is replaced by text. But yed_a is not replaced with ypd_a by the replacevar command as I've input it. If you can spot any errors, I would be very grateful!

I also tried your other suggestion - extracting the equation using:

string eqgidt = minmod4.@spec("gid_a")

Creates a string object called eqgidt, with a text version of the equation. But I am having trouble with the command syntax to modify the equation. I tried:

@replace ("eqipdt", "yed_a", "ypd_a") but that doesn't seem to do the trick. Any pointers would be most appreciated!
Thank you!

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

Re: Change pre-estimated equation

Postby EViews Gareth » Tue Apr 29, 2014 7:58 am

Might be a bug, we'll look into it.
Follow us on Twitter @IHSEViews

Return to “Models”

Who is online

Users browsing this forum: No registered users and 1 guest